#include <bits/stdc++.h>
using namespace std;
const long long int c = 100009;
long long int fact[c], inv[c], finv[c], num[c];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, k, x;
  cin >> n >> k;
  memset(num, 0, sizeof(num));
  num[0] = 1;
  cin >> x;
  num[x + 1] = -1;
  for (long long int j = 1; j < n; j++) {
    cin >> x;
    x++;
    for (long long int i = k; i > -1; i--)
      if (x + i <= k) num[x + i] = (num[x + i] - num[i]) % 1000000007;
  }
  long long int ans = 0, c = 100009;
  fact[0] = fact[1] = inv[0] = inv[1] = finv[0] = finv[1] = 1;
  for (long long int i = 2; i < c; i++) {
    fact[i] = fact[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
  long long int dr[k + 1];
  for (long long int i = 0; i <= k; i++)
    dr[i] = fact[n + i - 1] * finv[i] % 1000000007 * finv[n - 1] % 1000000007;
  for (long long int i = 0; i <= k; i++) {
    long long int add = dr[k - i] * num[i] % 1000000007;
    ans = (ans + add) % 1000000007;
  }
  cout << abs(ans) << endl;
}
