#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }
const ll MOD = 1e9 + 7;

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << fixed << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    FOR(i, h) cin >> s[i];

    vector<vector<ll>> dp, a, b, c;
    init(dp, 0, h, w);
    init(a, 0, h, w);
    init(b, 0, h, w);
    init(c, 0, h, w);
    dp[0][0] = a[0][0] = b[0][0] = c[0][0] = 1;

    FOR(i, h){
        FOR(j, w){
            if (i == 0 && j == 0) continue;
            if (s[i][j] == '#') continue;
            if (i) a[i][j] = a[i-1][j];
            if (j) b[i][j] = b[i][j-1];
            if (i && j) c[i][j] = c[i-1][j-1];

            dp[i][j] = a[i][j] + b[i][j] + c[i][j];
            dp[i][j] %= MOD;

            a[i][j] += dp[i][j];
            a[i][j] %= MOD;
            b[i][j] += dp[i][j];
            b[i][j] %= MOD;
            c[i][j] += dp[i][j];
            c[i][j] %= MOD;
        }
    }

    cout << dp[h-1][w-1] << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    while(t--){
        ll n,x,ans=0;
        cin >> n >> x;
        vector<ll> arr(n,0);
        for(int i=0;i<n;i++){
            cin >> arr[i];
        }
        vector<map<ll,ll>> dp(n,map<ll,ll> ());
        ll factor= x/arr[n-1];
        dp[n-1][factor*arr[n-1]-x]=1;
        if(abs((factor+1)*arr[n-1]-x) < arr[n-1])
            dp[n-1][(factor+1)*arr[n-1]-x]=1;
        for(int i=n-2;i>=0;i--){
            for(auto j: dp[i+1]){
                ll diff= j.first;
                factor=diff/arr[i];
                dp[i][diff-factor*arr[i]]+=j.second;
                if(diff<0){
                    if(abs(factor-1) < arr[i+1]/arr[i] && abs(diff-(factor-1)*arr[i]) < arr[i]){
                        dp[i][diff-(factor-1)*arr[i]]+=j.second;
                    }
                }
                else{
                    if(factor+1 < arr[i+1]/arr[i] && abs(diff-(factor+1)*arr[i]) < arr[i]){
                        dp[i][diff-(factor+1)*arr[i]]+=j.second;
                    }
                }
            }
            // if(dp[i].size() > 2){
            //     cout << "Error" << endl;
            //     break;
            // }
        }
        cout << dp[0][0] << endl;
    }
    return 0;
}