#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define INF LONG_MAX/3
#define DIV 1000000007
//#define DIV 998244353

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

int main(){
	ll N, M;
	cin >> N >> M;
	vector<ll> A(N);
	rep(i, N) cin >> A[i];

	ll rest = M;
	rep(i, N) rest -= A[i];

	if(rest == 0) {
		cout << 1 << endl;
		return 0;
	}
	if(rest < 0) {
		cout << 0 << endl;
		return 0;
	}

	ll ue = 1;
	ll si = 1;
	chmin(rest, M + N - rest);
	for(ll i = M + N; i> M + N - (rest); i--) {
		ue *= i;
		ue %= DIV;
	}
	for(ll i = rest; i >= 1; i--) {
		si *= i;
		si %= DIV;
	}
	cout << (ue * modpow(si, DIV-2))%DIV << endl;
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, M;
int A[2020];

i64 modpow(i64 x, int p = MOD - 2) {
	if (p == 0) return 1;
	i64 tmp = modpow(x, p / 2);
	tmp = tmp * tmp % MOD;
	if (p % 2 == 1) tmp = tmp * x % MOD;
	return tmp;
}

i64 C(i64 x, int y) {
	i64 ret = 1;
	for (int i = 0; i < y; ++i) {
		ret = ret * (x - i) % MOD;
		ret = ret * modpow(i + 1) % MOD;
	}
	return ret;
}

int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 0; i < N; ++i) scanf("%d", A + i);

	int sa = 0;
	for (int i = 0; i < N; ++i) sa += A[i];
	// printf("%lld\n", C(M + 1, sa + 1));
	printf("%lld\n", C(M + N, sa + N));

	return 0;
}
