#include <iostream>
#include <math.h>
#include <iomanip>
#include <bits/stdc++.h>
#include <string.h>
#include <string>
#include <algorithm>
#define ll long long int
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))

using namespace std;

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return (temp*temp);
    else
        return (((x*temp))*temp);
}


//nCr % mod
const int N0 = 2e6 + 5;
ll fact[6*N0];
ll inv[6*N0],invfac[6*N0];
ll mod = 1e9 + 7;

void factorial()
{
    fact[0] = invfac[0] = fact[1] = invfac[1] = 1;
    inv[1] = 1;
    for(int i=2;i<=5*N0 + 10;i++)
    {
        fact[i] = (fact[i-1]*i)%mod;
        inv[i] = (inv[mod%i]*(mod - mod/i))%mod;
        invfac[i] = (invfac[i-1]*inv[i])%mod;
    }
}

vector<ll> primes;

void Sieve(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primes.push_back(p);
}

//******************************************************    CHECK CONSTRAINTS   ***************************************************************//

const int N = 2e5 + 5;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n,m;
    ll sum = 0;
    cin >> n >> m;
    for(int i=0;i<n;i++)
    {
        ll x;
        cin >> x;
        sum += x;
    }
    m += n;
    sum += n;
    if(m < sum)
        return cout << 0,0;
    ll ans = 1;
    factorial();
    //cout << m << " " << sum << '\n';
    for(int i=0;i<sum;i++)
    {
        ll val = (m - i)*(inv[sum - i])%mod;
        //cout << val << "\n";
        ans = (ans * val)%mod;
    }
    cout << ans;
}

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

vector<long long int> inverse;

void factorial_Initialize(int max){
    inverse.assign(max+1,1);

    for (int i=2; i<=max; i++){
        inverse[i]   = MOD - inverse[MOD % i] * (MOD / i) % MOD;
    }
}

long long int nCr(int n, int r){
    factorial_Initialize(r);
    if(n < r || r < 0) return 0;
    
    long long int ans = 1;
    for(int i=0; i<r; i++){
        ans = ans * (n-i) % MOD * inverse[i+1] % MOD;
    }
    return ans;
}

int main(){
    int n, m;
    cin >> n >> m;

    int sum = 0;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum += a[i];
    }

    long long int ans = nCr(m+n, sum+n);
    cout << ans << endl;
    return 0;
}