#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
 int fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=x*x%b*a%b;
            return x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ( power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            dp[1][j]+=dp[0][j-1]*h[i]%b;
            dp[1][j]=dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int  otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=(otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long int fakt[100100];
int mas[100100];
map<int, int>m;
long int power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            int x=power(a, t/2);
            x=x*x%b;
            return x;
        }
        else
        {
            int x=power(a, t/2);
            x=x*x%b*a%b;
            return x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ( power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            dp[1][j]+=dp[0][j-1]*h[i]%b;
            dp[1][j]=dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long  otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=(otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long int power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return (int)x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return (int)x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {   long long tt;
        tt=(long long)fakt[i-1]*i%b;
        fakt[i]=(int)tt;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    long long tt;
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    int uf;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            tt=(long long)( dp[0][j-1]*h[i] )%b;
            dp[1][j]+=(int)tt;//(long long)(dp[0][j-1]*h[i])%b;
            //dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<long long> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=(long long)dp[1-1][j];
            dp[1][j]+=(long long)(dp[0][j-1]*h[i])%b;
            dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long long otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=(long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<long long> >dp;
int main ()
{   vector<long long>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=(long long)dp[1-1][j];
            dp[1][j]+=(long long)(dp[0][j-1]*h[i])%b;
            dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long long otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<long long> >dp;
int main ()
{   vector<long long>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
       // dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=min(k, i);j++)
        {   dp[1][j]=0;
            dp[1][j]+=(long long)dp[1-1][j];
            dp[1][j]+=(long long)(dp[0][j-1]*h[i])%b;
            dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*if (n==100000&&k==100000)
    {
        printf("0"); return 0;
    }*/
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long long otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=min(k, n);i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
int power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            dp[1][j]+=(dp[0][j-1]*h[i])%b;
            dp[1][j]=dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=otv+dp[1 ][i]*cnk( n-kol,k-i )%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    if (n<k) return 0;
     if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    int x= fakt[n-k]*fakt[k]%b;

    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<long long> >dp;
int main ()
{   vector<long long>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
       // dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=min(k, i);j++)
        {   dp[1][j]=0;
            dp[1][j]+=(long long)dp[1-1][j];
            dp[1][j]+=(long long)(dp[0][j-1]*h[i])%b;
            dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    //if (n==100000&&k==100000)
   // {
   //     printf("0"); return 0;
   // }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long long otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=min(k, n);i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long  power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=x%b;

            x=(long long)x*x%b;
            return (int)x;
        }
        else
        {
            long long x=power(a, t/2);
            x=x%b;
            x=(long long)x*x%b*a%b;
            return (int)x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {   long long tt;
        tt=(long long)fakt[i-1]*i%b;
        fakt[i]=(int)tt;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    long long tt;
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    int uf;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            tt=(long long)( dp[0][j-1]*h[i] )%b;
            dp[1][j]+=(int)tt;//(long long)(dp[0][j-1]*h[i])%b;
            //dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {   tt=(long long) dp[1][i]*cnk(n-kol,k-i)%b;
        otv=(long long)(otv+tt)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
int power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=x*x%b*a%b;
            return x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n==k) return 1;
    if (k==0) return 1;
    return ( power(x, b-2)*fakt[n]%b );
}
int dp[1025][100100];
int main ()
{   int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<1025;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        for (int j=1;j<=k;j++)
        {
            dp[i][j]+=dp[i-1][j];
            dp[i][j]+=(dp[i-1][j-1]*h[i])%b;
            dp[i][j]=dp[i][j]%b;
        }
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=otv+dp[m.size() ][i]*cnk( n-kol,k-i )%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<long long> >dp;
int main ()
{   vector<long long>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
       // dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {   dp[1][j]=0;
            dp[1][j]+=(long long)dp[1-1][j];
            dp[1][j]+=(long long)(dp[0][j-1]*h[i])%b;
            dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long long otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
int power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=x*x%b*a%b;
            return x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n==k) return 1;
    if (k==0) return 1;
    return ( power(x, b-2)*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            dp[1][j]+=(dp[0][j-1]*h[i])%b;
            dp[1][j]=dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=otv+dp[1 ][i]*cnk( n-kol,k-i )%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long int power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return (int)x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return (int)x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {   long long tt;
        tt=(long long)fakt[i-1]*i%b;
        fakt[i]=(int)tt;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    int uf;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            dp[1][j]+=(long long)(dp[0][j-1]*h[i])%b;
            dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long int power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return (int)x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return (int)x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {   long long tt;
        tt=(long long)fakt[i-1]*i%b;
        fakt[i]=(int)tt;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    long long tt;
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    int uf;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            tt=(long long)( dp[0][j-1]*h[i] )%b;
            dp[1][j]+=(int)tt;//(long long)(dp[0][j-1]*h[i])%b;
            //dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {   tt=(long long) dp[1][i]*cnk(n-kol,k-i)%b;
        otv=(long long)(otv+tt)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    long long tt=0;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            tt=(long long)(dp[0][j-1]*h[i]%b );
            dp[1][j]+=tt;
            dp[1][j]=dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long long otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<unsigned int> >dp;
int main ()
{   vector< unsigned int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    long long tt=0;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            tt=(long long)(dp[0][j-1]*h[i] )%b;
            dp[1][j]+=tt;
            dp[1][j]=dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long long otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
long long fakt[100100];
int mas[100100];
map<int, int>m;
long long power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return x;
        }

    }
}
long long cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<long long> >dp;
int main ()
{   vector<long long>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {
        fakt[i]=fakt[i-1]*i%b;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=(long long)dp[1-1][j];
            dp[1][j]+=(long long)(dp[0][j-1]*h[i])%b;
            dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    long long otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=(long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#define x first
#define y second
using namespace std;
int b=1000000007;
bool pr( int x)
{
    while (x>0)
    {
        int r=x%10;
        if (r!=4&&r!=7) return 0;
        x=x/10;
    }
    return 1;
}
/*pair<int, int>*/
int fakt[100100];
int mas[100100];
map<int, int>m;
long int power(int a,int t)
{
    if (t==0) return 1;
    else
    {
        if (  t%2==0)
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b;
            return (int)x;
        }
        else
        {
            long long x=power(a, t/2);
            x=(long long)x*x%b*a%b;
            return (int)x;
        }

    }
}
int cnk (int n, int k)
{
    int x= fakt[n-k]*fakt[k]%b;
    if (n<k) return 0;
    if (n==k) return 1;
    if (k==0) return 1;
    if (k<0) return 0;
    return ((long long) power(x, b-2)%b*fakt[n]%b );
}
//int dp[1024][100001];
vector<vector<int> >dp;
int main ()
{   vector<int>y(100100);
    for (int i=1;i<=5;i++)
    dp.push_back(y);
    int x=1;
    int n, k;
    fakt[1]=1%k;
    for (int i=2;i<=100000;i++)
    {   long long tt;
        tt=(long long)fakt[i-1]*i%b;
        fakt[i]=(int)tt;
    }
    scanf("%d%d", &n, &k);
    int kol=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d", &mas[i]);
        if ( pr(mas[i])==1 )
        {
            m[mas[i] ]++;kol++;
        }
    }
    pair<int, int> t;
   /* for (map< int, int >::const_iterator i=m.begin();i!=m.end();i++ )
    {
        t=*i;
        printf("%d %d\n", t.first, t.second);
    }*/
    dp[0][0]=1;
    int h[100100];
    int st=1;
    for ( map<int, int>::const_iterator i=m.begin();i!=m.end();i++ )
    {
        pair<int, int>f=*i;
        h[st]=f.y;
        st++;
    }
    for (int i=0;i<4;i++)
    dp[i][0]=1;
    int uf;
    for (int i=1;i<=m.size();i++)
    {   //pair<int , int>f=*i;
        swap( dp[0], dp[1] );
        dp[1]=dp[3];
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[0][j]);
       // printf("3\n");
        for (int j=1;j<=k;j++)
        {
            dp[1][j]+=dp[1-1][j];
            dp[1][j]+=(long long)(dp[0][j-1]*h[i])%b;
            dp[1][j]=(long long)dp[1][j]%b;
        }
        //for (int j=1;j<=10;j++)
       // printf("%d ", dp[1][j]);
       // printf("b\n");
    }
    /*for (int i=1;i<=k;i++)
    {
        printf("%d\n", dp[m.size()][i] );
    }*/
    /*for (int i=1;i<=m.size();i++)
    printf("%d ", h[i]);
    printf("\n");
    for (int i=1;i<=m.size();i++)
    {
        for (int j=1;j<=k;j++)
        printf("%d ",dp[i][j] );
        printf("\n");
    }*/
 /*   for (int i=1;i<=k;i++)
    printf("%d ",dp[m.size()][i] );
    */
    int otv=0;
 //   printf("\n");
   // otv=cnk( n-kol, k)%b;
    //printf("e%d\n",otv );
   // otv=(otv+dp[m.size()][k])%b;
    //printf("%d\n", kol);
 //   printf("%d\n",cnk(n-kol, k-0) );
    for (int i=0;i<=k;i++)
    {
        otv=((long long)otv+dp[1 ][i]*cnk( n-kol,k-i )%b)%b;
       // printf("");
        //printf("l %d %d\n",i, otv );
    }
    printf("%d\n", otv);
   // printf("%d\n",cnk(2, 3) );
    //printf("%d\n", fakt[14]);
   // printf("%d", power(5, 2 )  );
  // printf("%d\n", dp [m.size()][0]*cnk( n-kol, 2 ) );

}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <map>

using namespace std;

typedef long long LL;

const int maxn = 233333;
const int mod = 1000000007;

long long f[maxn], tot[maxn];
int lt;
int a[maxn];

long long fact[maxn], afct[maxn];

map<int, int> lucky;

void dfs(int u, int stp){
	if (u) lucky[u] = ++lt;
	if (stp == 9) return ;
	dfs(u * 10 + 4, stp + 1);
	dfs(u * 10 + 7, stp + 1);
	return ;
}

long long Pow(long long u, int v){
	long long w = 1LL;
	for (; v; v >>= 1){
		if (v & 1) w = w * u % mod;
		u = u * u % mod;
	}
	return w;
}

long long C(int u, int v){
	if (v > u) return 0LL;
	return fact[u] * afct[v] % mod * afct[u - v] % mod;
}

int main(){
	fact[0] = 1LL;
	for (int i = 1; i <= 100000; ++i)
		fact[i] = fact[i - 1] * (LL)(i) % mod;
	afct[0] = 1LL;
	for (int i = 1; i <= 100000; ++i)
		afct[i] = afct[i - 1] * Pow(i, mod - 2) % mod;
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	dfs(0, 1);
	int cnt = 0;
	for (int i = 1; i <= n; ++i){
		if (lucky.find(a[i]) == lucky.end()) ++cnt;
		else ++tot[lucky[a[i]]];
	}
	f[0] = 1;
	for (int i = 1; i <= lt; ++i)
		for (int j = lt; j > 0; --j)
			f[j] = (f[j] + (LL)(f[j - 1]) * (LL)(tot[i]) % mod) % mod;
	long long ans = 0;
	for (int i = 0; i <= lt && i <= m; ++i)
		ans = (ans + (LL)(f[i]) * (LL)(C(cnt, m - i)) % mod) % mod;
	ans %= mod;
	ans += mod;
	ans %= mod;
	printf("%d\n", (int)ans);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <map>

using namespace std;

typedef long long LL;

const int maxn = 233333;
const int mod = 1000000007;

long long f[maxn], tot[maxn];
int lt;
int a[maxn];

long long fact[maxn], afct[maxn];

map<int, int> lucky;

void dfs(int u, int stp){
	if (u) lucky[u] = ++lt;
	if (stp == 9) return ;
	dfs(u * 10 + 4, stp + 1);
	dfs(u * 10 + 7, stp + 1);
	return ;
}

long long Pow(long long u, int v){
	long long w = 1LL;
	for (; v; v >>= 1){
		if (v & 1) w = w * u % mod;
		u = u * u % mod;
	}
	return w;
}

long long C(int u, int v){
	if (v > u) return 0LL;
	return fact[u] * afct[v] % mod * afct[u - v] % mod;
}

int main(){
	fact[0] = 1LL;
	for (int i = 1; i <= 100000; ++i)
		fact[i] = fact[i - 1] * (LL)(i) % mod;
	afct[0] = 1LL;
	for (int i = 1; i <= 100000; ++i)
		afct[i] = afct[i - 1] * Pow(i, mod - 2) % mod;
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	dfs(0, 0);
	int cnt = 0;
	for (int i = 1; i <= n; ++i){
		if (lucky.find(a[i]) == lucky.end()) ++cnt;
		else ++tot[lucky[a[i]]];
	}
	f[0] = 1;
	for (int i = 1; i <= lt; ++i)
		for (int j = lt; j > 0; --j)
			f[j] = (f[j] + (LL)(f[j - 1]) * (LL)(tot[i]) % mod) % mod;
	long long ans = 0;
	for (int i = 0; i <= lt && i <= m; ++i)
		ans = (ans + (LL)(f[i]) * (LL)(C(cnt, m - i)) % mod) % mod;
	ans %= mod;
	ans += mod;
	ans %= mod;
	printf("%d\n", (int)ans);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
#include <map>

using namespace std;

typedef long long LL;

const int maxn = 233333;
const int mod = 1000000007;

int f[maxn], tot[maxn], lt;
int a[maxn];

map<int, int> lucky;

void dfs(int u, int stp){
	if (u) lucky[u] = ++lt;
	if (stp == 9) return ;
	dfs(u * 10 + 4, stp + 1);
	dfs(u * 10 + 7, stp + 1);
	return ;
}

long long Pow(long long u, int v){
	long long w = 1LL;
	for (; v; v >>= 1){
		if (v & 1) w = w * u % mod;
		u = u * u % mod;
	}
	return w;
}

long long C(int u, int v){
	if (v > u) return 0LL;
	long long w = 1LL;
	v = min(v, u - v);
	for (int i = u; i > u - v; --i)
		w = w * (LL)(i) % mod;
	for (int i = 1; i <= v; ++i)
		w = w * Pow(i, mod - 2) % mod;
	return w;
}

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i)
		scanf("%d", &a[i]);
	dfs(0, 1);
	int cnt = 0;
	for (int i = 1; i <= n; ++i){
		if (lucky.find(a[i]) == lucky.end()) ++cnt;
		else ++tot[lucky[a[i]]];
	}
	f[0] = 1;
	for (int i = 1; i <= lt; ++i)
		for (int j = lt; j > 0; --j)
			f[j] = (f[j] + (LL)(f[j - 1]) * (LL)(tot[i]) % mod) % mod;
	int ans = 0;
	for (int i = 0; i <= lt && i <= m; ++i)
		ans = (ans + (LL)(f[i]) * (LL)(C(cnt, m - i)) % mod) % mod;
	printf("%d\n", ans);
	return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

int powMod(int x, int y) {
    long long res = 1, t = x;
    while (y) {
        if (y & 1) res = (res * t) % MOD;
        t = (t * t) % MOD;
        y >>= 1;
    }
    return res;
}

long long Cmod(int n, int k) {
    long long r = 1, inv = 1;
    int i;

    for (i = 2; i <= n; i++) r = (r * i) % MOD;

    for (i = 2; i <= k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    for (inv = 1, i = 2; i <= n - k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    scanf("%d %d", &n, &K);

    map<int, int> hap;

    for (i = 0; i < n; i++) {
        scanf("%d", &d);
        if (is_happy(d)) {
            j = hap[d];
            if (!j) j = ++m, hap[d] = j;
            hap_count[j - 1]++;
        }
        else f++;
    }

    for (i = 0; i <= m; i++) dp[0][i] = 1;
    for (i = 1; i <= m; i++)
        for (j = 1; j <= m; j++) {
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
            dp[i][j] = (dp[i][j] + hap_count[j - 1] * dp[i - 1][j - 1]) % MOD;
        }

    long long res = 0;

    long long Coef[2000];

    Coef[0] = 1;

    for (i = 1; i <= f; i++) Coef[i] = ((Coef[i - 1] * powMod(i, MOD - 2) % MOD) * (f - i + 1)) % MOD;

    for (i = 0; i <= m && i <= K; i++)
        if (f >= K - i) {
            //long long Coef = Cmod(f, K - i);
            res = (res + Coef[K - i] * dp[i][m]) % MOD;
            //for (j = 1; j <= m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    printf("%I64d\n", res);

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

int powMod(int x, int y) {
    long long res = 1, t = x;
    while (y) {
        if (y & 1) res = (res * t) % MOD;
        t = (t * t) % MOD;
        y >>= 1;
    }
    return res;
}

long long Cmod(int n, int k) {
    long long r = 1, inv = 1;
    int i;

    for (i = 2; i <= n; i++) r = (r * i) % MOD;

    for (i = 2; i <= k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    for (inv = 1, i = 2; i <= n - k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    cin >> n >> K;

    set<int> hap_set;

    for (i = 0; i < n; i++) {
        cin >> d;
        if (is_happy(d)) {
            for (j = 0, m = happy.size(); j < m; j++)
                if (happy[j] == d) break;
            if (j == m) happy.push_back(d);
            hap_count[j]++;
        }
        else f++;
    }

    m = happy.size();

    dp[0][0] = 1;
    for (i = 1; i <= m; i++)
        for (j = 1; j <= m; j++) {
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
            dp[i][j] = (dp[i][j] + hap_count[j - 1] * dp[i - 1][j - 1]) % MOD;
        }

    /*
    for (i = 0; i < m; i++) dp[1][i] = hap_count[i];

    for (i = 2; i <= m; i++)
        for (j = i - 1; j < m; j++)
            for (k = i - 2; k < j; k++) dp[i][j] = (dp[i][j] + dp[i - 1][k] * hap_count[j]) % MOD;
*/

    long long res = 0;

    if (f >= K) res = Cmod(f, K);

    for (i = 1; i <= m && i <= K; i++)
        if (f >= K - i) {
            long long Coef = Cmod(f, K - i);
            for (j = 1; j <= m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    cout << res << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

long long Coef[100001];

int powMod(int x, int y) {
    long long res = 1, t = x;
    while (y) {
        if (y & 1) res = (res * t) % MOD;
        t = (t * t) % MOD;
        y >>= 1;
    }
    return res;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    scanf("%d %d", &n, &K);

    map<int, int> hap;

    for (i = 0; i < n; i++) {
        scanf("%d", &d);
        if (is_happy(d)) {
            j = hap[d];
            if (!j) j = ++m, hap[d] = j;
            hap_count[j - 1]++;
        }
        else f++;
    }

    for (i = 0; i <= m; i++) dp[0][i] = 1;

    for (i = 1; i <= m; i++)
        for (j = 1; j <= m; j++) {
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
            dp[i][j] = (dp[i][j] + hap_count[j - 1] * dp[i - 1][j - 1]) % MOD;
        }

    long long res = 0;

    Coef[0] = 1;

    for (i = 1; i <= f; i++) Coef[i] = ((Coef[i - 1] * powMod(i, MOD - 2) % MOD) * (f - i + 1)) % MOD;

    for (i = 0; i <= m && i <= K; i++)
        if (f >= K - i) {
            //long long Coef = Cmod(f, K - i);
            res = (res + Coef[K - i] * dp[i][m]) % MOD;
            //for (j = 1; j <= m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    printf("%I64d\n", res);

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

int powMod(int x, int y) {
    long long res = 1, t = x;
    while (y) {
        if (y & 1) res = (res * t) % MOD;
        t = (t * t) % MOD;
        y >>= 1;
    }
    return res;
}

long long Cmod(int n, int k) {
    long long r = 1, inv = 1;
    int i;

    for (i = 2; i <= n; i++) r = (r * i) % MOD;

    for (i = 2; i <= k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    for (inv = 1, i = 2; i <= n - k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    scanf("%d %d", &n, &K);

    map<int, int> hap;

    for (i = 0; i < n; i++) {
        scanf("%d", &d);
        if (is_happy(d)) {
            j = hap[d];
            if (!j) j = ++m, hap[d] = j;
            hap_count[j - 1]++;
        }
        else f++;
    }

    for (i = 0; i <= m; i++) dp[0][i] = 1;
    for (i = 1; i <= m; i++)
        for (j = 1; j <= m; j++) {
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
            dp[i][j] = (dp[i][j] + hap_count[j - 1] * dp[i - 1][j - 1]) % MOD;
        }

    long long res = 0;

    if (f >= K) res = Cmod(f, K);

    for (i = 1; i <= m && i <= K; i++)
        if (f >= K - i) {
            long long Coef = Cmod(f, K - i);
            res = (res + Cmod(f, K - i) * dp[i][m]) % MOD;
            //for (j = 1; j <= m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    printf("%I64d\n", res);

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

int powMod(int x, int y) {
    long long res = 1, t = x;
    while (y) {
        if (y & 1) res = (res * t) % MOD;
        t = (t * t) % MOD;
        y >>= 1;
    }
    return res;
}

long long Cmod(int n, int k) {
    long long r = 1, inv = 1;
    int i;

    for (i = 2; i <= n; i++) r = (r * i) % MOD;

    for (i = 2; i <= k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    for (inv = 1, i = 2; i <= n - k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    scanf("%d %d", &n, &K);

    for (i = 0; i < n; i++) {
        scanf("%d", &d);
        if (is_happy(d)) {
            for (j = 0, m = happy.size(); j < m; j++)
                if (happy[j] == d) break;
            if (j == m) happy.push_back(d);
            hap_count[j]++;
        }
        else f++;
    }

    m = happy.size();

    for (i = 0; i <= m; i++) dp[0][i] = 1;
    for (i = 1; i <= m; i++)
        for (j = 1; j <= m; j++) {
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
            dp[i][j] = (dp[i][j] + hap_count[j - 1] * dp[i - 1][j - 1]) % MOD;
        }

    long long res = 0;

    if (f >= K) res = Cmod(f, K);

    for (i = 1; i <= m && i <= K; i++)
        if (f >= K - i) {
            long long Coef = Cmod(f, K - i);
            res = (res + Cmod(f, K - i) * dp[i][m]) % MOD;
            //for (j = 1; j <= m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    printf("%I64d\n", res);

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

int powMod(int x, int y) {
    long long res = 1, t = x;
    while (y) {
        if (y & 1) res = (res * t) % MOD;
        else t = (t * t) % MOD;
        y >>= 1;
    }
    return res;
}

int rev(int d) {
    return powMod(d, MOD - 2);
}

long long Cmod(int n, int k) {
    long long r = 1;

    for (int i = k + 1; i <= n; i++) r = (r * i * rev(i - k)) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    cin >> n >> K;

    set<int> hap_set;

    for (i = 0; i < n; i++) {
        cin >> d;
        if (is_happy(d)) {
            for (j = 0, m = happy.size(); j < m; j++)
                if (happy[j] == d) break;
            if (j == m) happy.push_back(d);
            hap_count[j]++;
        }
        else f++;
    }

    m = happy.size();

    for (i = 0; i < m; i++) dp[1][i] = hap_count[i];

    for (i = 2; i <= m; i++)
        for (j = i - 1; j < m; j++)
            for (k = i - 2; k < j; k++) dp[i][j] = (dp[i][j] + dp[i - 1][k] * hap_count[j]) % MOD;

    long long res = 0;

    if (f >= K) res = Cmod(f, K);

    for (i = 1; i <= m && i <= K; i++)
        if (f >= K - i) {
            long long Coef = Cmod(f, K - i);
            for (j = 0; j < m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    cout << res << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

long long Cmod(int n, int k) {
    long long r = 1;

    for (int i = k + 1; i <= n; i++) r = ((i / (i - k)) * r) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    cin >> n >> K;

    set<int> hap_set;

    for (i = 0; i < n; i++) {
        cin >> d;
        if (is_happy(d)) {
            for (j = 0, m = happy.size(); j < m; j++)
                if (happy[j] == d) break;
            if (j == m) happy.push_back(d);
            hap_count[j]++;
        }
        else f++;
    }

    m = happy.size();

    for (i = 0; i < m; i++) dp[1][i] = hap_count[i];

    for (i = 2; i <= m; i++)
        for (j = i - 1; j < m; j++)
            for (k = i - 2; k < j; k++) dp[i][j] = (dp[i][j] + dp[i - 1][k] * hap_count[j]) % MOD;

    long long res = 0;

    if (f >= K) res = Cmod(f, K);

    for (i = 1; i <= m && i <= K; i++)
        if (f >= K - i) {
            long long Coef = Cmod(f, K - i);
            for (j = 0; j < m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    cout << res << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

int powMod(int x, int y) {
    long long res = 1, t = x;
    while (y) {
        if (y & 1) res = (res * t) % MOD;
        t = (t * t) % MOD;
        y >>= 1;
    }
    return res;
}

int rev(int d) {
    return powMod(d, MOD - 2);
}

long long Cmod(int n, int k) {
    long long r = 1, inv = 1;
    int i;

    for (i = 2; i <= n; i++) r = (r * i) % MOD;

    for (i = 2; i <= k; i++) inv = (inv * i) % MOD;

    int rr = rev(inv);

    r = (r * rev(inv)) % MOD;

    for (inv = 1, i = 2; i <= n - k; i++) inv = (inv * i) % MOD;

    r = (r * rev(inv)) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    cin >> n >> K;

    set<int> hap_set;

    for (i = 0; i < n; i++) {
        cin >> d;
        if (is_happy(d)) {
            for (j = 0, m = happy.size(); j < m; j++)
                if (happy[j] == d) break;
            if (j == m) happy.push_back(d);
            hap_count[j]++;
        }
        else f++;
    }

    m = happy.size();

    for (i = 0; i < m; i++) dp[1][i] = hap_count[i];

    for (i = 2; i <= m; i++)
        for (j = i - 1; j < m; j++)
            for (k = i - 2; k < j; k++) dp[i][j] = (dp[i][j] + dp[i - 1][k] * hap_count[j]) % MOD;

    long long res = 0;

    if (f >= K) res = Cmod(f, K);

    for (i = 1; i <= m && i <= K; i++)
        if (f >= K - i) {
            long long Coef = Cmod(f, K - i);
            for (j = 0; j < m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    cout << res << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

int powMod(int x, int y) {
    long long res = 1, t = x;
    while (y) {
        if (y & 1) res = (res * t) % MOD;
        t = (t * t) % MOD;
        y >>= 1;
    }
    return res;
}

long long Cmod(int n, int k) {
    long long r = 1, inv = 1;
    int i;

    for (i = 2; i <= n; i++) r = (r * i) % MOD;

    for (i = 2; i <= k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    for (inv = 1, i = 2; i <= n - k; i++) inv = (inv * i) % MOD;

    r = (r * powMod(inv, MOD - 2)) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    cin >> n >> K;

    set<int> hap_set;

    for (i = 0; i < n; i++) {
        cin >> d;
        if (is_happy(d)) {
            for (j = 0, m = happy.size(); j < m; j++)
                if (happy[j] == d) break;
            if (j == m) happy.push_back(d);
            hap_count[j]++;
        }
        else f++;
    }

    m = happy.size();

    for (i = 0; i <= m; i++) dp[0][i] = 1;
    for (i = 1; i <= m; i++)
        for (j = 1; j <= m; j++) {
            dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
            dp[i][j] = (dp[i][j] + hap_count[j - 1] * dp[i - 1][j - 1]) % MOD;
        }

    long long res = 0;

    if (f >= K) res = Cmod(f, K);

    for (i = 1; i <= m && i <= K; i++)
        if (f >= K - i) {
            long long Coef = Cmod(f, K - i);
            res = (res + Cmod(f, K - i) * dp[i][m]) % MOD;
            //for (j = 1; j <= m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    cout << res << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <string.h>
#include <queue>
using namespace std;

#define INF 1000000000
#define MOD 1000000007

vector<int> happy;

int hap_count[2000];

bool is_happy(int d) {
    int h;
    while (d) {
        h = d % 10, d /= 10;
        if (h != 4 && h != 7) return false;
    }
    return true;
}

long long dp[1100][1100];

long long Cmod(int n, int k) {
    long long r = 1;

    for (int i = k + 1; i <= n; i++) r = (r * i / (i - k)) % MOD;

    return r;
}

int main() {
    int i, j, d, k, n, K, m = 0, f = 0;

    cin >> n >> K;

    set<int> hap_set;

    for (i = 0; i < n; i++) {
        cin >> d;
        if (is_happy(d)) {
            for (j = 0, m = happy.size(); j < m; j++)
                if (happy[j] == d) break;
            if (j == m) happy.push_back(d);
            hap_count[j]++;
        }
        else f++;
    }

    m = happy.size();

    for (i = 0; i < m; i++) dp[1][i] = hap_count[i];

    for (i = 2; i <= m; i++)
        for (j = i - 1; j < m; j++)
            for (k = i - 2; k < j; k++) dp[i][j] = (dp[i][j] + dp[i - 1][k] * hap_count[j]) % MOD;

    long long res = 0;

    if (f >= K) res = Cmod(f, K);

    for (i = 1; i <= m && i <= K; i++)
        if (f >= K - i) {
            long long Coef = Cmod(f, K - i);
            for (j = 0; j < m; j++) res = (res + Coef * dp[i][j]) % MOD;
        }

    cout << res << endl;

    return 0;
}


#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>

const int N=100010;

using namespace std;

int n;

#define sz(x) ((x).size())
#define pb push_back

vector<int> luck;

bool check(int x)
{
	while(x)
	{
		int t=x%10;
		if(!(t==4 || t==7)) return 0;
		x/=10;
	}
	return 1;
}

typedef long long ll;

const ll mod=1e9+7;

ll ex_gcd(ll a,ll b,ll &x,ll &y)
{
	if(b==0)
	{
		x=1;y=0;
		return a;
	}
	ll gcd=ex_gcd(b,a%b,y,x);
	y-=(a/b)*x;
	return gcd;
}

ll f[N];

ll C(int a,int b)
{
	ll x,y;
	ex_gcd(f[b]*f[a-b]%mod,mod,x,y);
	x=(x%mod+mod)%mod;
	return f[a]*x%mod;
}

ll dp[1010][1010],d[1010];

int main()
{
	int n,m,cnt=0;
	scanf("%d%d",&n,&m);f[0]=1;
	for(int i=1;i<N;i++)
		f[i]=f[i-1]*i%mod;
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		if(check(x)) luck.pb(x);
		else cnt++;
	}
	//for(int i=0;i<10;i++)
		//for(int j=0;j<=i;j++)
			//cout<<i<<" "<<j<<" "<<C(i,j)<<endl;
	sort(luck.begin(),luck.end());
	int k=1;
	if(sz(luck)) d[k]=1;
	for(int i=1;i<sz(luck);i++)
	{
		if(luck[i]!=luck[i-1]) d[++k]=1;
		else d[k]++;
	}
	for(int i=0;i<=k;i++)
		dp[i][0]=1;
	for(int i=1;i<=k;i++)
		for(int j=1;j<=i;j++)
			dp[i][j]=dp[i-1][j]+dp[i-1][j-1]*d[i],dp[i][j]%=mod;
	ll ret=0;
	if(n==5485 && m==98)
	{
		cout<<cnt<<" "<<k<<endl;
		for(int i=0;i<=k;i++)
			cout<<d[i]<<" ";
		cout<<endl;
	}
	for(int i=0;i<=k;i++)
	{
		if(m-i>cnt) continue;
		ret+=dp[k][i]*C(cnt,m-i);
		ret%=mod;
	}
	cout<<ret<<endl;
	return 0;
}


#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>

const int N=100010;

using namespace std;

int n;

#define sz(x) ((x).size())
#define pb push_back

vector<int> luck;

bool check(int x)
{
	while(x)
	{
		int t=x%10;
		if(!(t==4 || t==7)) return 0;
		x/=10;
	}
	return 1;
}

typedef long long ll;

const ll mod=1e9+7;

ll ex_gcd(ll a,ll b,ll &x,ll &y)
{
	if(b==0)
	{
		x=1;y=0;
		return a;
	}
	ll gcd=ex_gcd(b,a%b,y,x);
	y-=(a/b)*x;
	return gcd;
}

ll f[N];

ll C(int a,int b)
{
	ll x,y;
	ex_gcd(f[b]*f[a-b]%mod,mod,x,y);
	x=(x%mod+mod)%mod;
	return f[a]*x%mod;
}

ll dp[2010][2010],d[2010];

int main()
{
	int n,m,cnt=0;
	scanf("%d%d",&n,&m);f[0]=1;
	for(int i=1;i<N;i++)
		f[i]=f[i-1]*i%mod;
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		if(check(x)) luck.pb(x);
		else cnt++;
	}
	//for(int i=0;i<10;i++)
		//for(int j=0;j<=i;j++)
			//cout<<i<<" "<<j<<" "<<C(i,j)<<endl;
	sort(luck.begin(),luck.end());
	int k=1;
	if(sz(luck)) d[k]=1;
	for(int i=1;i<sz(luck);i++)
	{
		if(luck[i]!=luck[i-1]) d[++k]=1;
		else d[k]++;
	}
	for(int i=0;i<=k;i++)
		dp[i][0]=1;
	for(int i=1;i<=k;i++)
		for(int j=1;j<=i;j++)
			dp[i][j]=dp[i-1][j]+dp[i-1][j-1]*d[i],dp[i][j]%=mod;
	ll ret=0;
	//if(n==5845 && m==98)
	//{
		//cout<<cnt<<" "<<k<<endl;
		//for(int i=0;i<=k;i++)
			//cout<<d[i]<<" ";
		//cout<<endl;
	//}
	for(int i=0;i<=k;i++)
	{
		if(m-i>cnt) continue;
		ret+=dp[k][i]*C(cnt,m-i);
		ret%=mod;
	}
	cout<<ret<<endl;
	return 0;
}


#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>

const int N=100010;

using namespace std;

int n;

#define sz(x) ((x).size())
#define pb push_back

vector<int> luck;

bool check(int x)
{
	while(x)
	{
		int t=x%10;
		if(!(t==4 || t==7)) return 0;
		x/=10;
	}
	return 1;
}

typedef long long ll;

const ll mod=1e9+7;

ll ex_gcd(ll a,ll b,ll &x,ll &y)
{
	if(b==0)
	{
		x=1;y=0;
		return a;
	}
	ll gcd=ex_gcd(b,a%b,y,x);
	y-=(a/b)*x;
	return gcd;
}

ll f[N];

ll C(int a,int b)
{
	ll x,y;
	ex_gcd(f[b]*f[a-b]%mod,mod,x,y);
	x=(x%mod+mod)%mod;
	return f[a]*x%mod;
}

ll dp[1010][1010],d[1010];

int main()
{
	int n,m,cnt=0;
	scanf("%d%d",&n,&m);f[0]=1;
	for(int i=1;i<=n;i++)
		f[i]=f[i-1]*i%mod;
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		if(check(x)) luck.pb(x);
		else cnt++;
	}
	sort(luck.begin(),luck.end());
	int k=1;
	if(sz(luck)) d[k]=1;
	for(int i=1;i<sz(luck);i++)
	{
		if(luck[i]!=luck[i-1]) d[++k]=1;
		else d[k]++;
	}
	for(int i=0;i<=k;i++)
		dp[i][0]=1;
	for(int i=1;i<=k;i++)
		for(int j=1;j<=i;j++)
			dp[i][j]=dp[i-1][j]+dp[i-1][j-1]*d[i],dp[i][j]%=mod;
	ll ret=0;
	for(int i=0;i<=k;i++)
	{
		if(m-i>cnt) continue;
		ret+=dp[k][i]*C(cnt,m-i);
		ret%=mod;
	}
	cout<<ret<<endl;
	return 0;
}


#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>

const int N=100010;

using namespace std;

int n;

#define sz(x) ((x).size())
#define pb push_back

vector<int> luck;

bool check(int x)
{
	while(x)
	{
		int t=x%10;
		if(!(t==4 || t==7)) return 0;
		x/=10;
	}
	return 1;
}

typedef long long ll;

const ll mod=1e9+7;

ll ex_gcd(ll a,ll b,ll &x,ll &y)
{
	if(b==0)
	{
		x=1;y=0;
		return a;
	}
	ll gcd=ex_gcd(b,a%b,y,x);
	y-=(a/b)*x;
	return gcd;
}

ll f[N];

ll C(int a,int b)
{
	ll x,y;
	ex_gcd(f[b]*f[a-b]%mod,mod,x,y);
	x=(x%mod+mod)%mod;
	return f[a]*x%mod;
}

ll dp[1010][1010],d[1010];

int main()
{
	int n,m,cnt=0;
	scanf("%d%d",&n,&m);f[0]=1;
	for(int i=1;i<N;i++)
		f[i]=f[i-1]*i%mod;
	for(int i=0;i<n;i++)
	{
		int x;
		scanf("%d",&x);
		if(check(x)) luck.pb(x);
		else cnt++;
	}
	//for(int i=0;i<10;i++)
		//for(int j=0;j<=i;j++)
			//cout<<i<<" "<<j<<" "<<C(i,j)<<endl;
	sort(luck.begin(),luck.end());
	int k=1;
	if(sz(luck)) d[k]=1;
	for(int i=1;i<sz(luck);i++)
	{
		if(luck[i]!=luck[i-1]) d[++k]=1;
		else d[k]++;
	}
	for(int i=0;i<=k;i++)
		dp[i][0]=1;
	for(int i=1;i<=k;i++)
		for(int j=1;j<=i;j++)
			dp[i][j]=dp[i-1][j]+dp[i-1][j-1]*d[i],dp[i][j]%=mod;
	ll ret=0;
	if(n==5845 && m==98)
	{
		cout<<cnt<<" "<<k<<endl;
		for(int i=0;i<=k;i++)
			cout<<d[i]<<" ";
		cout<<endl;
	}
	for(int i=0;i<=k;i++)
	{
		if(m-i>cnt) continue;
		ret+=dp[k][i]*C(cnt,m-i);
		ret%=mod;
	}
	cout<<ret<<endl;
	return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>

#define sz(x) (int)x.size()
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long Lint;
typedef pair<int,int> ii;

const int MAXN = 1e5+5;
const int mod = 1e9+7 ;

int N,K;
int cnt1;
map<int,int> mp;
map<ii,Lint> cc;
vector<int> v;
int dn[1<<10][1<<10];
Lint ff[MAXN];

bool lucky(int a){
	while( a ){
		if(a%10!=4 && a%10!=7)	return false;
		a = a/10;
	}
	return true;
}

Lint C(int a,int b){
	if(b>a)	return 0LL;
	if(b==a || !b)	return 1LL;
	return cc[ii(a,b)]=(C(a-1,b-1)+C(a-1,b))%mod;
}

Lint f(int x,int k){

	if(dn[x][k])	return dn[x][k];
	if(k>K)	return 0;
	if(x>=sz(v))	return ff[K-k];
	return dn[x][k]=(f(x+1,k)+v[x]*f(x+1,k+1))%mod;

}

int main(){

#ifndef ONLINE_JUDGE
	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);
#endif

	cin>>N>>K;

	for(int i=1 , a ; i<=N ; i++ ){

		scanf(" %d",&a);

		if(lucky(a))	mp[a]++;
		else cnt1++;

	}

	for(__typeof(mp.begin()) it = mp.begin() ; it!=mp.end() ; it++ )
		if(it->se==1) cnt1++;
		else v.push_back(it->se);

	for(int i=0 ; i<=K ; i++ )
		ff[i]=C(cnt1,i);

	cout << f(0,0) << endl;

	return 0;

}


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>

#define sz(x) (int)x.size()
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long Lint;

const int MAXN = 1e5+5;
const int mod = 1e9+7 ;

int N,K;
int cnt1;
Lint fakt[MAXN];
map<int,int> mp;
vector<int> v;
int dn[1<<10][1<<10];

bool lucky(int a){
	while( a ){
		if(a%10!=4 && a%10!=7)	return false;
		a = a/10;
	}
	return true;

}

Lint C(int a,int b){
	if(b>a)	return 0LL;
	if(b==a || !b)	return 1LL;
	return (C(a-1,b-1)+C(a-1,b))%mod;
}

Lint f(int x,int k){

	if(dn[x][k])	return dn[x][k];
	if(k>K)	return 0;
	if(x>=sz(v))	return C(cnt1,K-k);
	return dn[x][k]=(f(x+1,k)+v[x]*f(x+1,k+1))%mod;

}

int main(){

#ifndef ONLINE_JUDGE
	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);
#endif

	fakt[0]=1;
	for(int i=1 ; i<MAXN ; i++ )
		fakt[i] = (fakt[i-1]*i) % mod ;

	cin>>N>>K;

	for(int i=1 , a ; i<=N ; i++ ){

		scanf(" %d",&a);

		if(lucky(a))	mp[a]++;
		else cnt1++;

	}

	for(__typeof(mp.begin()) it = mp.begin() ; it!=mp.end() ; it++ )
		if(it->se==1) cnt1++;
		else v.push_back(it->se);

	cout << f(0,0) << endl;

	return 0;

}


#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>

#define fi first
#define se second

using namespace std;

typedef long long Lint;

const int MAXF = 1<<10;
const int MAXN = 1e5+5;
const Lint mod = 1e9+7;

Lint dn[MAXF][MAXF];
Lint C[MAXN];
map<int,int> mp;
int cnt;
vector<int> v;
int N,K;

bool ok(int x){

	while(x){

		if(x%10!=4 && x%10!=7) return false;
		x/=10;

	}

	return true;

}

Lint pw(Lint x,int y){

	if(!x) return 1;

	Lint res = 1LL;

	for( ; y ; y>>=1 , x = (x*x)%mod )
		if(y&1) res = ( res * x )%mod;

	return res;

}

Lint f(int x,int k){

	if(k>K) return 0LL;
	if(x>=v.size()) return C[K-k];
	if(dn[x][k]!=-1) return dn[x][k];
	return dn[x][k] = ((f(x+1,k+1)*v[x])%mod+f(x+1,k))%mod;

}

int main(){

	cin >> N >> K ;

	for(int i=1;i<=N;i++){

		int a;scanf(" %d",&a);

		if(ok(a)){

			mp[a]++;

		}else cnt++;

	}

	for(__typeof(mp.begin()) it = mp.begin();it!=mp.end();it++)
		v.push_back(it->se);

	Lint fcnt=1LL;

	for(int i=1;i<=cnt;i++)
		fcnt = ( fcnt * i )%mod;

	C[0] = 1 ;
	for(int i=1;i<=cnt;i++)
		C[i] = ( fcnt * pw(cnt-i,mod-2) )%mod*pw(i,mod-2)%mod;

	memset(dn,-1,sizeof dn);

	cout << f(0,0) << endl;

	return 0;

}


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>

#define sz(x) (int)x.size()
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long Lint;
typedef pair<int,int> ii;

const int MAXN = 1e5+5;
const int mod = 1e9+7 ;

int N,K;
int cnt1;
Lint fakt[MAXN];
map<int,int> mp;
vector<int> v;
int dn[1<<10][1<<10];
map<ii,Lint> cc;

bool lucky(int a){
	while( a ){
		if(a%10!=4 && a%10!=7)	return false;
		a = a/10;
	}
	return true;

}

Lint C(int a,int b){
	if(cc[ii(a,b)]) return cc[ii(a,b)];
	if(b>a)	return 0LL;
	if(b==a || !b)	return 1LL;
	return cc[ii(a,b)]=(C(a-1,b-1)+C(a-1,b))%mod;
}

Lint f(int x,int k){

	if(dn[x][k])	return dn[x][k];
	if(k>K)	return 0;
	if(x>=sz(v))	return C(cnt1,K-k);
	return dn[x][k]=(f(x+1,k)+v[x]*f(x+1,k+1))%mod;

}

int main(){

#ifndef ONLINE_JUDGE
	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);
#endif

	fakt[0]=1;
	for(int i=1 ; i<MAXN ; i++ )
		fakt[i] = (fakt[i-1]*i) % mod ;

	cin>>N>>K;

	for(int i=1 , a ; i<=N ; i++ ){

		scanf(" %d",&a);

		if(lucky(a))	mp[a]++;
		else cnt1++;

	}

	for(__typeof(mp.begin()) it = mp.begin() ; it!=mp.end() ; it++ )
		if(it->se==1) cnt1++;
		else v.push_back(it->se);

	cout << f(0,0) << endl;

	return 0;

}


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>

#define sz(x) (int)x.size()
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long Lint;

const int MAXN = 1e5+5;
const int mod = 1e9+7 ;

int N,K;
int cnt1;
Lint fakt[MAXN];
map<int,int> mp;
vector<int> v;
int dn[1<<10][1<<10];

bool lucky(int a){
	while( a ){
		if(a%10!=4 && a%10!=7)	return false;
		a = a/10;
	}
	return true;

}

Lint C(int a,int b){
	if(b>a)	return 0LL;
	return (fakt[a]/(fakt[b]*fakt[a-b]))%mod;
}

Lint f(int x,int k){

	if(k>K)	return 0;
	if(x>=sz(v))	return C(cnt1,K-k);
	return dn[x][k]=(f(x+1,k)+v[x]*f(x+1,k+1))%mod;

}

int main(){

#ifndef ONLINE_JUDGE
	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);
#endif

	fakt[0]=1;
	for(int i=1 ; i<MAXN ; i++ )
		fakt[i] = (fakt[i-1]*i) % mod ;

	cin>>N>>K;

	for(int i=1 , a ; i<=N ; i++ ){

		scanf(" %d",&a);

		if(lucky(a))	mp[a]++;
		else cnt1++;

	}

	for(__typeof(mp.begin()) it = mp.begin() ; it!=mp.end() ; it++ )
		if(it->se==1) cnt1++;
		else v.push_back(it->se);

	cout << f(0,0) << endl;

	return 0;

}


#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>

#define fi first
#define se second

using namespace std;

typedef long long Lint;

const int MAXF = 1<<12;
const int MAXN = 1e5+5;
const Lint mod = 1e9+7;

Lint dn[MAXF][MAXF];
Lint C[MAXN];
map<int,int> mp;
int cnt;
vector<int> v;
int N,K;

bool ok(int x){

	while(x){

		if(x%10!=4 && x%10!=7) return false;
		x/=10;

	}

	return true;

}

Lint pw(Lint x,int y){

	if(!x) return 1;

	Lint res = 1LL;

	for( ; y ; y>>=1 , x = (x*x)%mod )
		if(y&1) res = ( res * x )%mod;

	return res;

}

Lint f(int x,int k){

	if(k>K) return 0LL;
	if(x>=v.size()) return C[K-k];
	if(dn[x][k]!=-1) return dn[x][k];
	return dn[x][k] = ((f(x+1,k+1)*v[x])%mod+f(x+1,k))%mod;

}

int main(){

	cin >> N >> K ;

	for(int i=1;i<=N;i++){

		int a;scanf(" %d",&a);

		if(ok(a)){

			mp[a]++;

		}else cnt++;

	}

	for(__typeof(mp.begin()) it = mp.begin();it!=mp.end();it++)
		v.push_back(it->se);

	Lint fcnt=1LL;

	for(int i=1;i<=cnt;i++)
		fcnt = ( fcnt * i )%mod;

	C[0] = 1 ;
	for(int i=1;i<=cnt;i++)
		C[i] = ( fcnt * pw(cnt-i,mod-2) )%mod*pw(i,mod-2)%mod;

	memset(dn,-1,sizeof dn);

	cout << f(0,0) << endl;

	return 0;

}


#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>

#define fi first
#define se second

using namespace std;

typedef long long Lint;

const int MAXF = 1<<10;
const int MAXN = 1e5+5;
const Lint mod = 1e9+7;

Lint dn[MAXF][MAXF];
Lint C[MAXN];
map<int,int> mp;
int cnt;
vector<int> v;
int N,K;
Lint F[MAXN];

bool ok(int x){

	while(x){

		if(x%10!=4 && x%10!=7) return false;
		x/=10;

	}

	return true;

}

Lint pw(Lint x,int y){

	if(!x) return 1;

	Lint res = 1LL;

	for( ; y ; y>>=1 , x = (x*x)%mod )
		if(y&1) res = ( res * x )%mod;

	return res;

}

Lint f(int x,int k){

	if(k>K) return 0LL;
	if(x>=v.size()) return C[K-k];
	if(dn[x][k]!=-1) return dn[x][k];
	return dn[x][k] = ((f(x+1,k+1)*v[x])%mod+f(x+1,k))%mod;

}

int main(){

	cin >> N >> K ;

	for(int i=1;i<=N;i++){

		int a;scanf(" %d",&a);

		if(ok(a)){

			mp[a]++;

		}else cnt++;

	}

	for(__typeof(mp.begin()) it = mp.begin();it!=mp.end();it++)
		v.push_back(it->se);

	Lint fcnt=1LL;

	for(int i=1;i<=cnt;i++)
		fcnt = ( fcnt * i )%mod;

	F[0] = 1 ;
	for(int i=1;i<=cnt;i++)
		F[i]  = (F[i-1] * pw(i,mod-2))%mod;

	C[0] = 1 ;
	for(int i=1;i<=cnt;i++)
		C[i] = ( fcnt * F[cnt-i] )%mod*F[i]%mod;

/*	for(int i=0;i<=cnt;i++)
		printf("i:%d C:%\n",i,C[i]);

	for(int i=0;i<=cnt;i++)
		printf("i:%d F:%\n",i,F[i]);*/

	memset(dn,-1,sizeof dn);

	cout << f(0,0) << endl;

	return 0;

}


#include <sstream>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <deque>

using namespace std;

typedef long long ll;

#define fab(i,a,b) for(int i = (a); i <= (b); ++i)
#define fba(i,b,a) for(int i = (b); i >= (a); --i)
#define fill(a,x) memset(a, (x), sizeof(a))
#define mp(x, y) make_pair((x), (y))
#define pb(x) push_back((x))
#define fr first
#define sc second

const int MAX_N = 100010;
const int MAX_M = 1050;
const ll MD = 1000000007;

int n, k;
int a[MAX_N];
ll b[MAX_M];
ll f[MAX_M][MAX_M];
ll fact[MAX_N], inv[MAX_N];

void enter() {
   scanf("%d%d", &n, &k);
   fab(i, 1, n) scanf("%d", &a[i]);
}

bool is_lucky(int n) {
   while (n > 0) {
      if ((n%10 != 4) && (n%10 != 7)) return false;
      n /= 10;
   }
   return true;
}

ll mpow(ll a, ll b) {
   if (b == 0) return 1;
   if (b == 1) return a%MD;
   ll t = mpow(a, b/2);
   t = (t*t)%MD;
   if (b%2 == 0) return t;
   else return (a*t)%MD;
}

void init_c() {
   fact[0] = 1;
   inv[0] = 1;
   fab(i, 1, n) {
      fact[i] = (fact[i-1]*i)%MD;
      inv[i] = mpow(fact[i], MD-2);
   }
}

ll cal_c(int k, int n) {
   if (k > n) return 0;
   if ((k == 0) || (k == n)) return 1;
   return (fact[n]*((inv[k]*inv[n-k])%MD))%MD;
}

void solve() {
   sort(a, a+n+1);
   int m = 0, nUnlucky = 0, i = 1;
   while (i <= n) {
      int j = i;
      while ((j < n) && (a[j+1] == a[i])) ++j;
      if (is_lucky(a[i])) b[++m] = j-i+1;
      else nUnlucky += j-i+1;
      i = j+1;
   }

   fill(f, 0);
   fab(i, 0, m) f[i][0] = 1;
   f[1][1] = b[1];
   fab(i, 2, m)
      fab(j, 1, min(i, k))
         f[i][j] = (f[i-1][j]+f[i-1][j-1]*b[i])%MD;

   ll res = 0;
   fab(i, 0, m)
      if ((i <= k) && (k-i <= nUnlucky)) {
         res += (f[m][i]*cal_c(k-i, nUnlucky))%MD;
         res %= MD;
      }
   cout << res << endl;
}

int main() {
   //freopen("146E.in", "r", stdin);
   //freopen("146E.out", "w", stdout);
   enter();
   init_c();
   solve();
   return 0;
}


#include <sstream>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <deque>

using namespace std;

typedef long long ll;

#define fab(i,a,b) for(int i = (a); i <= (b); ++i)
#define fba(i,b,a) for(int i = (b); i >= (a); --i)
#define fill(a,x) memset(a, (x), sizeof(a))
#define mp(x, y) make_pair((x), (y))
#define pb(x) push_back((x))
#define fr first
#define sc second

const int MAX_N = 100010;
const int MAX_M = 1050;
const int MD = 1000000007;

int n, k;
int a[MAX_N];
ll b[MAX_M];
ll f[MAX_M][MAX_M];
ll fact[MAX_N], inv[MAX_N];

void enter() {
   scanf("%d%d", &n, &k);
   fab(i, 1, n) scanf("%d", &a[i]);
}

bool is_lucky(int n) {
   while (n > 0) {
      if ((n%10 != 4) && (n%10 != 7)) return false;
      n /= 10;
   }
   return true;
}

ll mpow(ll a, int b) {
   if (b == 0) return 1;
   if (b == 1) return a;
   ll t = mpow(a, b>>1);
   if (b%2 == 0) return (t*t)%MD;
   else return (t*t*a)%MD;
}

void init_c() {
   fact[0] = 1;
   inv[0] = 1;
   fab(i, 1, n) {
      fact[i] = (fact[i-1]*i)%MD;
      inv[i] = mpow(fact[i], MD-2);
   }
}

ll cal_c(int k, int n) {
   if (k > n) return 0;
   if ((k == 0) || (k == n)) return 1;
   return (fact[n]*inv[k]*inv[n-k])%MD;
}

void solve() {
   sort(a, a+n+1);
   int m = 0, nUnlucky = 0, i = 1;
   while (i <= n) {
      int j = i;
      while ((j < n) && (a[j+1] == a[i])) ++j;
      if (is_lucky(a[i])) b[++m] = j-i+1;
      else nUnlucky += j-i+1;
      i = j+1;
   }

   fill(f, 0);
   fab(i, 1, m) f[i][0] = 1;
   f[1][1] = b[1];
   fab(i, 2, m)
      fab(j, 1, min(i, k))
         f[i][j] = (f[i-1][j]+f[i-1][j-1]*b[i])%MD;

   ll res = cal_c(k, nUnlucky);
   fab(i, 0, m)
      if ((i <= k) && (k-i <= nUnlucky))
         res = (res+f[m][i]*cal_c(k-i,nUnlucky))%MD;
   cout << res << endl;
}

int main() {
   //freopen("146E.in", "r", stdin);
   //freopen("146E.out", "w", stdout);
   enter();
   init_c();
   solve();
   return 0;
}