#include<bits/stdc++.h>
#define ll long long
#define re register
#define INF 2147483647
using namespace std;

inline int read()
{
	int f=1,x=0;char s=getchar();
	while(s<'0'||s>'9')
	{
		if(s=='-') f=-1;
		s=getchar();
	}
	while(s>='0'&&s<='9')
	{
		x=x*10+s-48;
		s=getchar();
	}
	return f*x;
}

const int p=1e9+7;

inline int ksm(int a,int b)
{
	int ans=1;
	for(;b;b>>=1,a=1ll*a*a%p)
		if(b&1) ans=1ll*ans*a%p;
	return ans;
}

int main()
{
	int n=read(),m=read();
	int sum=0;
	for(int i=1;i<=n;i++) sum+=read();
	int ans=1;
	sum+=n;
	n+=m;
	if(sum>n)
	{
		puts("0");
		return 0;
	}
	int t1=1,t2=1;
	for(int i=1;i<=sum;i++)
		t1=1ll*t1*(n-i+1)%p,t2=1ll*t2*i%p;
	printf("%d\n",1ll*t1*ksm(t2,p-2)%p);
	return 0;
}
#include <bits/stdc++.h>
#define rep(i, n)for(int i=0,i<(n);++i)
using namespace std;
using ll = long long;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint C(ll x, ll y) {
    mint a = 1, b = 1;
    if (x < y) return 0;
    for (int i = 1; i <= y; i++)
        a = a * (x - i + 1);
    for (int i = 1; i <= y; i++)
        b = b * i;
    return a * b.inv();
}

int main(){
  ll n, m; cin >> n >> m;
  int s = 0;
  for(int i = 0; i < n; i++){
    ll a; cin >> a;
    s += a;
  }
  mint ans;
  ans = C(m+n, s+n); //二項係数a_C_bを計算する
  cout << ans << endl;
  return 0;
}