#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int mod = 1000000007;

LL _pow(LL a, LL b) {
  if(!b) return 1;
  if(b == 1) return a;
  if(b == 2) return a * a % mod;
  if(b & 1) {
    return a * _pow(a,b-1) % mod;
  }
  return _pow(_pow(a,b/2),2);
}

int main() {
  int n,m;
  S2(n,m);
  int num = n + m;
  int den = n;
  rep(i,0,n) {
    int x;
    S(x);
    den += x;
  }
  if(den > num) {
    P(0);
    return 0;
  }
  LL ans = 1;
  rep(i,1,den+1) {
    ans = ans * (num + 1 - i) % mod;
    ans = ans * _pow(i, mod - 2) % mod;
  }
  cout << ans << "\n";
  return 0;
}

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

constexpr int MOD = 1e9 + 7;

long long inv(long long n, long long mod) {
    long long res = 1;
    while (n > 1) {
        (res *= (mod - mod / n)) %= mod;
        n = mod % n;
    }
    return res;
}

long long comb_mod(long long n, long long r, long long mod) {
    r = (r <= n/2) ? r : n-r;
    if (r < 0) return 0;
    if (r == 0) return 1;

    long long nume = 1, deno = 1;
    for (long long i=1; i<=r; i++) {
        deno *= i % mod;
        deno %= mod;
    }
    for (long long i=n-r+1; i<=n; i++) {
        nume *= i % mod;
        nume %= mod;
    }
    deno = inv(deno, mod);
    return (deno * nume) % mod;
}


void solve() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    for (int i=0; i<N; ++i) cin >> A[i];

    int sumA = 0;
    for (int x : A) sumA += x;
    cout << comb_mod(M + N, sumA + N, MOD) << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}
