#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
long long int modd = 1e9 + 7;
vector<long long int> fact;
void addMod(int& a, int b) {
  a = a + b;
  while (a >= mod) a -= mod;
}
long long int powMod(long long int& a, long long int b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long int x = powMod(a, b / 2);
  x = (x * x) % modd;
  if (b % 2) x = (x * a) % modd;
  return x;
}
long long int ei(long long int& a) { return powMod(a, modd - 2); }
long long int ncr(int n, int r) {
  return (((fact[n] * ei(fact[r])) % modd) * ei(fact[n - r])) % modd;
}
int main() {
  int n, k;
  cin >> n >> k;
  int t = n * (k + 1) + 1;
  fact.assign(n + k + 2, 0);
  fact[0] = 1;
  for (int i = 1; i < n + k + 1; i++) fact[i] = (fact[i - 1] * i) % modd;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] += 1;
  }
  int ap[t];
  int an[t];
  int tp[t];
  int tn[t];
  memset(ap, 0, sizeof(ap));
  memset(an, 0, sizeof(an));
  memset(tp, 0, sizeof(tp));
  memset(tn, 0, sizeof(tn));
  ap[0] = 1;
  int ma = 0;
  for (int i = 0; i < n; i++) {
    for (int j = a[i]; j < ma + a[i] + 1; j++) {
      addMod(tn[j], ap[j - a[i]]);
      addMod(tp[j], an[j - a[i]]);
    }
    for (int j = a[i]; j < ma + a[i] + 1; j++) {
      addMod(ap[j], tp[j]);
      addMod(an[j], tn[j]);
    }
    ma += a[i];
    memset(tp, 0, sizeof(tp));
    memset(tn, 0, sizeof(tn));
  }
  long long int ans = 0;
  for (int i = 0; i < k + 1; i++) {
    int j = k - i;
    if (ap[i]) {
      ans = (ans + (ap[i] * ncr(n + j - 1, j)) % modd + modd) % modd;
    }
    if (an[i]) {
      ans = (ans - (an[i] * ncr(n + j - 1, j)) % modd + modd) % modd;
    }
  }
  ans = (ans + modd) % modd;
  cout << ans << "\n";
  return 0;
}
