#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int, int> >
#define vpll vector <pair <long long, long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vb vector <bool>
#define vvb vector <vb>
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MANX MAXN
#define itn int
#define dbg(x); {cout<<#x<<"="<<x<<", ";}
#define in(x); { for (auto &to : x) cin>>to;}
#define out(x); { for (auto &to : x) cout<<to<<" ";cout<<'\n'; }

const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const int mod1 = 1e9+7;
const int mod2 = 1e9+21;
int add(int a,int b)
{
    a+=b;
    if (a>=mod1)
        return a-mod1;
    return a;
}

int mult(int a,int b)
{
    return 1ll*a*b%mod1;
}

int sub(int a,int b)
{
    a-=b;
    if (a<0)
        return a+mod1;
    return a;
}

int bin_pow(int base,ll deg)
{
    if (deg==0)
        return 1;
    int t=bin_pow(base,deg/2);
    if (deg&1)
        return 1ll*t*t%mod1*base%mod1;
    else
        return 1ll*t*t%mod1;
}
int C(int n,int k)
{
    int ans=1;
    for (int i=n-k+1;i<=n;i++)
        ans=mult(ans,i);
    for (int i=1;i<=k;i++)
        ans=mult(ans,bin_pow(i,mod1-2));
    return ans;
}
void solve()
{
    int n,m;
    cin>>n>>m;
    vi a(n);
    in(a);
    int sum=accumulate(all(a),0);
    if (sum>m)
    {
        cout<<0<<'\n';
        return;
    }
    m=m-sum;
    int k=sum+n;
    cout<<C(m+k,k)<<'\n';
}

int main() {
    #ifdef Mip182
    #else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #endif
    #ifdef Mip182
    freopen("a.in", "r", stdin);
    #endif
    int _t;
    _t=1;
//    cin>>_t;
    while (_t--)
        solve();
    #ifdef Mip182
    cout<<'\n'<<"Time : "<<(double)(clock())/CLOCKS_PER_SEC<<'\n';
    #endif
}

#include <bits/stdc++.h>

using namespace std;

template<class T>
using vec = vector<T>;
template<class T>
using v2d = vector<vector<T>>;

using ld = long double;
using ll = long long;

const ll M = 1e9+7;

int main()
{
    int h, w;
    cin>>h>>w;
    v2d<int> b(h, vec<int>(w, 1));
    v2d<ll> r(h, vec<ll>(w, 0));
    v2d<ll> vert(h, vec<ll>(w, 0));
    v2d<ll> hori(h, vec<ll>(w, 0));
    v2d<ll> diag(h, vec<ll>(w, 0));
    r[0][0] = 1;
    vert[0][0] = 1;
    hori[0][0] = 1;
    diag[0][0] = 1;
    string s;
    for(int i = 0; i < h; i++)
    {
        cin>>s;
        for(int j = 0; j < w; j++)
        {
            s[j] == '#' && b[i][j]--;
        }
    }
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            if (!b[i][j])
            {
                continue;
            }
            if (i)
            {
                r[i][j] += vert[i-1][j];
            }
            if (j)
            {
                r[i][j] += hori[i][j-1];
            }
            if (i && j)
            {
                r[i][j] += diag[i-1][j-1];
            }
            vert[i][j] = r[i][j];
            hori[i][j] = r[i][j];
            diag[i][j] = r[i][j];
            if (i)
            {
                vert[i][j] += vert[i-1][j];
            }
            if (j)
            {
                hori[i][j] += hori[i][j-1];
            }
            if (i && j)
            {
                diag[i][j] += diag[i-1][j-1];
            }
            r[i][j] %= M;
            vert[i][j] %= M;
            hori[i][j] %= M;
            diag[i][j] %= M;
        }
    }
    cout<<r[h-1][w-1]<<'\n';
    return 0;
}
