#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9+7;

vector<vector<ll>> calc_ncr(const int n){
    vector<vector<ll>> ret(n+1, vector<ll>(n+1, 0));
    for(int i=0; i<=n; ++i){
        ret[i][0] = 1;
        for(int j=1; j<i; ++j){
            ret[i][j] = ret[i-1][j] + ret[i-1][j-1];
        }
        ret[i][i] = 1;
    }
    return ret;
}

ll solve_naive(const int n, const int m, const vector<int> &a){
    const auto ncr = calc_ncr(m);
    if(n==3){
        ll ret = 0;
        for(int b0=a[0]; b0<=m-2; ++b0){
            for(int b1=a[1]; b0+b1<=m-1; ++b1){
                for(int b2=a[2]; b0+b1+b2<=m; ++b2){
                    ret += ncr[b0][a[0]] * ncr[b1][a[1]] * ncr[b2][a[2]];
                }
            }
        }
        return ret;
    }else{
        return 0;
    }
}

ll inv(ll a, ll b = MOD){
    ll x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b != 0) {
        const ll q = a / b;
        ll tmp = a % b;
        a = b;
        b = tmp;
        tmp = x0 - q * x1;
        x0 = x1;
        x1 = tmp;
        tmp = y0 - q * y1;
        y0 = y1;
        y1 = tmp;
    }
    return (x0 + MOD) % MOD;
}

vector<ll> calc_ncr_n(const ll n, const ll r_max){
    vector<ll> ret(r_max+1);
    ret[0] = 1;
    for(ll r=1; r<=r_max; ++r){
        ret[r] = ((ret[r-1] * (n - r + 1)) % MOD * inv(r)) % MOD;
    }
    return ret;
}

ll solve(const int n, const int m, const vector<int> &a){
    ll sum_a = 0;
    for(int i=0; i<n; ++i)sum_a += a[i];
    const auto ncr = calc_ncr_n(m+n, sum_a+n+1);
    return ncr[sum_a+n];
}

int main()
{
    ll n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i=0; i<n; ++i)cin >> a[i];
    //cout << solve_naive(n, m, a) << endl;
    cout << solve(n, m, a) << endl;
}
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define endl "\n"
using namespace std;

const int Mod = 1e9+7;

int power(int a,int b){
	if(b==0) return 1;
	int temp = power(a,b/2)%Mod;
	if(b%2==0){
		return (temp*temp)%Mod;
	}else{
		return (a*((temp*temp)%Mod))%Mod;
	}
}

int nCr(int n,int r){
	if(r>n) return 0;
	int num=1;
	for(int i=n;i>=(n-r+1);i--){
		num=(num*i)%Mod;
	}
	int den=1;
	for(int i=1;i<=r;i++){
		den=(den*i)%Mod;
	}
	return (num*power(den,Mod-2))%Mod;
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n,m;
	cin>>n>>m;
	int a[n];
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	if(sum>m){
		cout<<0<<endl;
		return 0;
	}
	
	int ans=1;
	int options=1;
	for(int i=0;i<n;i++){
		if(a[i]==0){
			options++;
			continue;
		}
		for(int j=1;j<=a[i];j++){
			if(j==a[i]){
				options+=2;
			}else{
				options+=1;
			}
		}
	}
	ans = nCr(m-sum+options-1,options-1);
	cout<<ans<<endl;

}