//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,m; cin>>n>>m;
    char arr[n+10][m+10];
    for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>arr[i][j];
    ll dp[n+10][m+10];
    memset(dp,0,sizeof(dp));
    ll col[m+10]={0};
    dp[1][1]=1;
    col[1]=1;
    ll di[n+10][m+10];
    memset(di,0,sizeof(di));
    di[1][1]=1;
    ll sum=1;
    for(int i=2;i<=m;i++){
        if(arr[1][i]=='#') sum=0;
        dp[1][i]=sum;
        sum=(sum+dp[1][i]%mod);
        col[i]=dp[1][i];
        di[1][i]=dp[1][i];
    }
    sum=1;
    for(int i=2;i<=n;i++){
        if(arr[i][1]=='#') sum=0;
        dp[i][1]=sum;
        sum=(sum+dp[i][1]%mod);
        di[i][1]=dp[i][1];
    }
    for(int i=2;i<=n;i++){
        sum=dp[i][1];
        for(int j=2;j<=m;j++){
            if(arr[i][j]=='#') {
                sum=0;
                col[j]=0;
                di[i][j]=0;
                dp[i][j]=0;
            }
            else{
                ll val=sum;
                val=(val+col[j])%mod;
                val=(val+di[i-1][j-1]);
                dp[i][j]=val%mod;
                sum=(sum+val)%mod;
                col[j]=(val+col[j])%mod;
                di[i][j]=(val+di[i-1][j-1])%mod;
            }
        }
    }
    // for(int i=1;i<=n;i++) {
    //     for(int j=1;j<=m;j++) cout<<dp[i][j]<<" ";
    //     cout<<endl;
    // }
    cout<<dp[n][m]%mod<<endl;
}
#include <bits/stdc++.h>

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
typedef long long LL;

const int MAXN = 55;
const int MOD = 1E9 + 7;
LL n, x, a[MAXN], g[MAXN], dp[MAXN][2];

template <class T>
void read(T& x) {
    x = 0;
    T f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
    while (ch >= '0' && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
    x *= f;
}

template <class T, class... Args>
void read(T& x, Args&... args) {
    read(x), read(args...);
}

signed main() {
    read(n, x);
    for (int i = 1; i <= n; i++) read(a[i]);
    for (int i = n; i >= 1; i--) {
        if (!x) break;
        g[i] = x / a[i], x %= a[i];
    }
    for (int i = n - 1; i >= 1; i--) {
        LL lim = a[i + 1] / a[i];
        if (g[i] == 0) {
            dp[i][0] = dp[i + 1][0];
            dp[i][1] = dp[i + 1][1] + dp[i + 1][0] + 1;
        } else if (g[i] == lim - 1) {
            dp[i][0] = dp[i + 1][0] + dp[i + 1][1] + 1;
            dp[i][1] = dp[i + 1][1];
        } else {
            dp[i][1] = dp[i + 1][1] + dp[i + 1][0] + 1;
            dp[i][0] = dp[i + 1][0] + dp[i + 1][1] + 1;
        }
    }
    cout << dp[1][0] + 1;
    return 0;
}