#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const double PI = acos(-1);
vector<complex<double> > omega;
long long FFT_N, mod = 1e9 + 7;
vector<vector<long long> > ans;
void init_fft(long long n) {
  FFT_N = n;
  omega.resize(n);
  double angle = 2 * PI / n;
  for (int i = 0; i < n; i++)
    omega[i] = complex<double>(cos(i * angle), sin(i * angle));
}
void fft(vector<complex<double> >& a) {
  long long n = (long long)a.size();
  if (n == 1) return;
  long long half = n >> 1;
  vector<complex<double> > even(half), odd(half);
  for (int i = 0, j = 0; i < n; i += 2, ++j) {
    even[j] = a[i];
    odd[j] = a[i + 1];
  }
  fft(even), fft(odd);
  for (int i = 0, fact = FFT_N / n; i < half; ++i) {
    complex<double> twiddle = odd[i] * omega[i * fact];
    a[i] = even[i] + twiddle;
    a[i + half] = even[i] - twiddle;
  }
}
void multiply(const vector<long long>& a, const vector<long long>& b,
              vector<long long>& res) {
  vector<complex<double> > fa(a.begin(), a.end()), fb(b.begin(), b.end());
  long long n = 1;
  while (n < 2 * max(a.size(), b.size())) n <<= 1;
  fa.resize(n), fb.resize(n);
  init_fft(n);
  fft(fa), fft(fb);
  for (size_t i = 0; i < n; ++i) fa[i] = conj(fa[i] * fb[i]);
  fft(fa);
  res.resize(n);
  for (size_t i = 0; i < n; ++i) {
    res[i] = (long long)(fa[i].real() / n + 0.5);
    res[i] %= mod;
  }
}
vector<long long> solve(int start, int end) {
  if (start == end) {
    return ans[start];
  }
  vector<long long> a, b, c;
  int mid = start + end >> 1;
  a = solve(start, mid);
  b = solve(mid + 1, end);
  multiply(a, b, c);
  return c;
}
int main() {
  int n, k;
  cin >> n >> k;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int r;
    cin >> r;
    sum += r;
    vector<long long> t;
    for (int j = 0; j <= r; j++) {
      t.push_back(1);
    }
    ans.push_back(t);
  }
  if (sum < k) {
    printf("0\n");
    return 0;
  }
  vector<long long> sol = solve(0, ans.size() - 1);
  printf("%lld\n", sol[k]);
}
