#include<stdio.h>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define SIZE 5000000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i) * inv[mod % i] % mod;
	}
	kai[0] = invkai[0] = 1;
	for (int i = 1; i <= SIZE; i++)
	{
		kai[i] = kai[i - 1] * i % mod;
		invkai[i] = invkai[i - 1] * inv[i] % mod;
	}
}
ll com(ll a, ll b)
{
	if (b < 0 || a < b)return 0;
	return (invkai[b] * invkai[a - b]) % mod * kai[a] % mod;
}
int main()
{
	int n, m;
	cin >> n >> m;
	int s = n;
	invinit();
	for (int i = 0; i < n; i++)
	{
		int z;
		cin >> z;
		s += z;
	}
	ll r = 1;
	if (n + m < s)
	{
		printf("0\n");
		return 0;
	}
	for (int i = 0; i < s; i++)
	{
		r = r * inv[s - i] % mod;
		r = r * (n + m - i) % mod;
	}
	printf("%lld\n", r);
}
#include "iostream"
#include "algorithm"
#include "cstring"
#include "cstdio"
#include "cmath"
#include "vector"
#include "map"
#include "set"
#include "queue"
using namespace std;
#define MAXN 200006
//#define int long long
#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define all(x) (x).begin() , (x).end()
#define mem( a ) memset( a , 0 , sizeof a )
typedef long long ll;
const int P = 1e9 + 7;
int n , m;
int A[MAXN];

int Pow( int x , int a ) {
    int ret = 1;
    while( a ) {
        if( a & 1 ) ret = ret * 1ll * x % P;
        x = x * 1ll * x % P , a >>= 1;
    }
    return ret;
}

int C( int a , int b ) {
    int ret = 1;
    per( i , a , a - b + 1 ) ret = ret * 1ll * i % P;
    rep( i , 1 , b ) ret = ret * 1ll * Pow( i , P - 2 ) % P;
    return ret;
}

void solve() {
    cin >> n >> m;
    int sa = 0;
    rep( i , 1 , n ) scanf("%d",A + i) , sa += A[i];
    cout << C( m + n , sa + n ) << endl;
}

signed main() {
//	freopen("input","r",stdin);
//    int T;cin >> T;while( T-- ) solve();
    solve();
}
