#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b, long long int m) {
  long long int res = 1;
  a = a % m;
  while (b > 0) {
    if (b % 2 == 1) res = (res * a) % m;
    a = (a * a) % m;
    b /= 2;
  }
  return res;
}
long long int factinv(long long int n, long long int mod) {
  return power(n, mod - 2, mod);
}
long long int NCR(long long int n, long long int r, long long int mod) {
  if (r == 0) return 1;
  long long int f[110005];
  f[0] = f[1] = 1;
  for (int i = 0; i < 110001; i++) {
    f[i + 2] = (f[i + 1] % mod * (i + 2) % mod) % mod;
  }
  return ((f[n] % mod * factinv(f[n - r], mod) % mod) * factinv(f[r], mod) %
          mod) %
         mod;
}
int main() {
  long long int n, k, mod = 1000000007, y = 0;
  cin >> n >> k;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  if (k == 0)
    cout << 1 << "\n";
  else {
    long long int x = NCR(n + k - 1, n - 1, mod);
    for (int i = 0; i < n; i++) {
      if (k > a[i])
        y = (y % mod + NCR(n + k - a[i] - 2, n - 1, mod) % mod) % mod;
    }
    cout << (x % mod - y % mod) % mod << "\n";
  }
}
