#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll base=1000000007;
ll n,k,a,v[300],num[300],other,ans=0ll;
ll f[300][300];
bool judge(ll b)
{
ll a=b;
int p;
while(a>0)
{
p=a%10;
if(p!=4&&p!=7)
return false;
a/=10;
}
for(p=1;p<=v[0];p++)
if(num[p]==b)
{
v[p]++;
return true;
}
num[++num[0]]=b;
v[++v[0]]=1;
return true;
}
ll c(ll a,ll b)
{
if(a<b)
return 0;
if(b==1)
return a;
if(a==b||b==0)
return 1;
return c(a-1,b)+c(a-1,b-1);
}
main()
{
int i,j;
cin>>n>>k;
for(i=1;i<=n;i++)
{
cin>>a;
if(!judge(a))
other++;
}
f[0][0]=1;
for(i=1;i<=v[0];i++)
{
f[i][0]=1;
for(j=1;j<=v[0];j++)
f[i][j]=f[i-1][j]+f[i-1][j-1]*v[i];
}
for(i=0;i<=min(k,v[0]);i++)
ans=(ans+f[v[0]][i]*c(other,k-i))%base;
cout<<ans;
}