#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,total=1ll,ans=0ll;
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);
}
void work(int step,int now)
{
	if(now>k)	return ;
	if(step>v[0])
	{
		ans=ans+total*c(other,k-now);
		ans%=base;
	}
	else 
	{
		for(int i=0;i<=1;i++)
		{
			if(i==0)
				work(step+1,now);
			else
			{
				total*=v[step];
				work(step+1,now+1);
				total/=v[step];
			}
		}
	}
}
main()
{
	int i;
	cin>>n>>k;
	for(i=1;i<=n;i++)
	{
		cin>>a;
		if(!judge(a))
			other++;
	}
	work(1,0);
	cout<<ans;
}