#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long n,k,jishu,tot,sum[1024],xuanzhe[1024],c[200000];
long long qpow(long long a,long long b)
{
long long ans=1;
while(b!=0)
{
if(b&1)
ans=ans*a%mod;
a=a*a%mod;
b>>=1;
}
return ans;
}
long long C()
{
c[0]=1;
for(int i=1;i<=jishu;i++)
c[i]=c[i-1]*(jishu-i+1)%mod*qpow(i,mod-2)%mod;
}
long long luck[1024],cnt;
void dfs(long long k,long long dep)
{
if(k)
luck[++cnt]=k;
if (dep==10)
return;
dfs(k*10+4,dep+1);
dfs(k*10+7,dep+1);
}
int main()
{
//freopen("lucky.in","r",stdin);
//freopen("lucky.out","w",stdout);
cin>>n>>k;
dfs(0,1);
sort(luck+1,luck+1+cnt);
jishu=n;
for(long long i=1;i<=n;++i)
{
long long h;
cin>>h;
long long weizhi=lower_bound(luck+1,luck+1+cnt,h)-luck;
if(luck[weizhi]==h)
sum[weizhi]++;
if(sum[weizhi]==2)
jishu-=2;
else
if(sum[weizhi]>2)
jishu--;
}
xuanzhe[0]=1;
for(long long i=1;i<=cnt;++i)
if(sum[i]>=2)
for(long long j=i;j>=1;--j)
xuanzhe[j]=(xuanzhe[j]+xuanzhe[j-1]*sum[i])%mod;
C();
for(long long i=0;i<=k;++i)
if(i<=jishu)
tot=(tot+c[i]*xuanzhe[k-i]%mod)%mod;
cout<<tot;
return 0;
}