#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=4.5e6+51,MOD=1e9+7;
ll n,m,sm,res;
ll invf[MAXN];
inline ll read()
{
	register ll num=0,neg=1;
	register char ch=getchar();
	while(!isdigit(ch)&&ch!='-')
	{
		ch=getchar();
	}
	if(ch=='-')
	{
		neg=-1;
		ch=getchar();
	}
	while(isdigit(ch))
	{
		num=(num<<3)+(num<<1)+(ch-'0');
		ch=getchar();
	}
	return num*neg;
}
int main()
{
	n=read(),m=read(),res=m+n,invf[1]=1;
	for(register int i=1;i<=n;i++)
	{
		sm+=read();
	}
	if(m<sm)
	{
		return puts("0"),0;
	}
	for(register int i=2,j=m+n-1;i<=n+sm;i++,j--)
	{
		invf[i]=MOD-(li)(MOD/i)*invf[MOD%i]%MOD;
		res=(li)res*j%MOD*invf[i]%MOD;
	}
	printf("%d\n",res);
}
#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
ll Inv[4002005];
ll C(ll r,ll n)
{
	if(r>n) return 0;
	ll ret=1;
	for(int i=1;i<=r;i++) ret=ret*(n-i+1)%MOD*Inv[i]%MOD;
	return ret;
}
int main() {
	ll n,m,Sum1;
	Inv[0]=Inv[1]=1;
	for(int i=2;i<=4002000;i++) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;	
	scanf("%lld %lld",&n,&m);Sum1=n;
	for(int i=1,x;i<=n;i++) scanf("%d",&x),Sum1+=x;
	printf("%lld",C(Sum1,m+n));
	return 0;
}