#include <bits/stdc++.h>
using namespace std;
int64_t beki(int64_t n){
vector<int64_t> vec(50);
int64_t x,i,s,ans;
i=0;
ans=1;
x=1000000005;
while(x>0){
  vec.at(i)=x%2;
  x=x/2;
  i++;    
}
s=n;
for(int64_t j=0;j<50;j++){
  if(vec.at(j)==1){ans=(ans*s)%1000000007;}  
  s=(s*s)%1000000007; 
}
return ans;              
}

int64_t combi(int64_t p,int64_t q){
int64_t syutu;
syutu=1;
for(int64_t j=p;j>=p-q+1;j--){syutu=(syutu*j)%1000000007;}
for(int64_t j=1;j<=q;j++){syutu=(syutu*beki(j))%1000000007;}
return syutu;
}

int main() {
int64_t p,q,a,sum;
  sum=0;
int64_t n,m;
  cin>>n>>m;
p=n+m;
  for(int64_t i=0;i<n;i++){
  cin>>a;
    sum=sum+a;
  }
  q=n+sum;
if(p>=q){cout<<combi(p,q)<<endl;}
  else{cout<<0<<endl;}
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <ctype.h>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#define INF 0x3f3f3f3f
#define eps 1e-8
// #define _
using namespace std;
typedef long long ll;
const int maxn=2e3+5;
const int mod=1e9+7;
int x[maxn];
ll fpow(ll a,ll b,ll c)
{
    ll ans=1;
    while(b)
    {
        if(b&1) ans=ans*a%c;
        a=a*a%c;
        b>>=1;
    }
    return ans;
}

ll inv(ll x)
{
    return fpow(x,mod-2,mod);
}

ll C(ll n,ll m)
{
    if(n<m) return 0;
    m=min(m,n-m);
    ll a=1,b=1;
    for(int i=1;i<=m;i++)
    {
        a=a*(n-i+1)%mod;
        b=b*i%mod;
    }
    return a*inv(b)%mod;
}

int main()
{
    #ifdef _
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif

    int n,m;
    ll sum=0;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x[i]);
        sum+=x[i];
    }
    printf("%lld\n",C(m+n,sum+n));
    return 0;
}