#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
constexpr int inf=1000001000;
constexpr ll INF=2e18;
constexpr ll MOD=1000000007;
// ll MOD=998244353;
constexpr ll mod=998244353;

void Add(int &a, int b) {
  a += b;
  while (a >= MOD) a -= MOD;
  while (a < 0) a += MOD;
}
 
void Mul(int &a, int b) {
  a = 1LL * a * b % MOD;
}
 
int Pow(int b, int e) {
  if (e < 0) e += MOD - 1;
  int ret = 1;
  while (e) {
    if (e & 1) ret = 1LL * ret * b % MOD;
    b = 1LL * b * b % MOD;
    e >>= 1;
  }
  return ret;
}
 

int main() {
    ll n,m,s;
    s=0;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) s+=a[i];
    ll ans=1;
    rep(i,s+n) (ans*=(m+n-i))%=MOD;
    rep(i,s+n) (ans*=Pow(i+1,MOD-2))%=MOD;
    cout << ans << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int n,m,sum,ans,a[2005];
int ksm(int n,int m){
	if (!m)return 1;
	int s=ksm(n,m>>1);
	s=1LL*s*s%mod;
	if (m&1)s=1LL*s*n%mod;
	return s;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	sum+=n;
	m+=n;
	//c(m,sum)
	ans=1;
	for(int i=1;i<=sum;i++)ans=1LL*ans*ksm(i,mod-2)%mod*(m-i+1)%mod;
	printf("%d",ans);
}