#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],fact[50001];
ll fast(ll a,ll b)
{
ll res=1;
while(b){
if(b&1)res=res*a%base;
b>>=1;
a=a*a%base;
}
return res;
}
ll c(ll n,ll m)
{
if(n>m)return 0;
return fact[m]*fast(fact[m-n],base-2)%base*fast(fact[n],base-2)%base;
}
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;
}
main()
{
ll 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=1;i<=n;i++)
fact[i]=fact[i-1]*i%base;
for(i=0;i<=min(k,v[0]);i++)
ans=(ans+f[v[0]][i]*c(other,k-i))%base;
cout<<ans;
}