#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
const long long INF = 100000000000000000LL;
const long long NCK_MAX = 510000;
template <class T>
T extgcd(T a, T b, T& x, T& y) {
  for (T u = y = 1, v = x = 0; a;) {
    T q = b / a;
    swap(x -= q * u, u);
    swap(y -= q * v, v);
    swap(b -= q * a, a);
  }
  return b;
}
template <class T>
T mod_inv(T a, T m) {
  T x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}
long long mod_pow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long p = a % mod;
  while (n) {
    if (n & 1) ret = ret * p % mod;
    p = p * p % mod;
    n >>= 1;
  }
  return ret;
}
template <long long mod, long long primitive_root>
class NTT {
 public:
  long long get_mod() const { return mod; }
  void _ntt(vector<long long>& a, long long sign) {
    const long long n = ((long long)(a).size());
    assert((n ^ (n & -n)) == 0);
    const long long g = 3;
    long long h = (long long)mod_pow(g, (mod - 1) / n, mod);
    if (sign == -1) h = (long long)mod_inv(h, mod);
    long long i = 0;
    for (long long j = 1; j < n - 1; ++j) {
      for (long long k = n >> 1; k > (i ^= k); k >>= 1)
        ;
      if (j < i) swap(a[i], a[j]);
    }
    for (long long m = 1; m < n; m *= 2) {
      const long long m2 = 2 * m;
      const long long base = mod_pow(h, n / m2, mod);
      long long w = 1;
      for (long long x = 0; x < (m); x++) {
        for (long long s = x; s < n; s += m2) {
          long long u = a[s];
          long long d = a[s + m] * w % mod;
          a[s] = u + d;
          if (a[s] >= mod) a[s] -= mod;
          a[s + m] = u - d;
          if (a[s + m] < 0) a[s + m] += mod;
        }
        w = w * base % mod;
      }
    }
    for (auto& x : a)
      if (x < 0) x += mod;
  }
  void ntt(vector<long long>& input) { _ntt(input, 1); }
  void llt(vector<long long>& input) {
    _ntt(input, -1);
    const long long n_inv = mod_inv(((long long)(input).size()), mod);
    for (auto& x : input) x = x * n_inv % mod;
  }
  vector<long long> convolution(const vector<long long>& a,
                                const vector<long long>& b) {
    long long ntt_size = 1;
    while (ntt_size < ((long long)(a).size()) + ((long long)(b).size()))
      ntt_size *= 2;
    vector<long long> _a = a, _b = b;
    _a.resize(ntt_size);
    _b.resize(ntt_size);
    ntt(_a);
    ntt(_b);
    for (long long i = 0; i < (ntt_size); i++) {
      (_a[i] *= _b[i]) %= mod;
    }
    llt(_a);
    return _a;
  }
};
long long garner(vector<pair<long long, long long> > mr, long long mod) {
  mr.emplace_back(mod, 0);
  vector<long long> coffs(((long long)(mr).size()), 1);
  vector<long long> constants(((long long)(mr).size()), 0);
  for (long long i = 0; i < (((long long)(mr).size()) - 1); i++) {
    long long v = (mr[i].second - constants[i]) *
                  mod_inv<long long>(coffs[i], mr[i].first) % mr[i].first;
    if (v < 0) v += mr[i].first;
    for (long long j = i + 1; j < ((long long)(mr).size()); j++) {
      (constants[j] += coffs[j] * v) %= mr[j].first;
      (coffs[j] *= mr[i].first) %= mr[j].first;
    }
  }
  return constants[((long long)(mr).size()) - 1];
}
vector<long long> llmod_convolution(vector<long long> a, vector<long long> b,
                                    long long mod) {
  for (auto& x : a) x %= mod;
  for (auto& x : b) x %= mod;
  NTT<167772161, 3> ntt1;
  NTT<469762049, 3> ntt2;
  NTT<1224736769, 3> ntt3;
  auto x = ntt1.convolution(a, b);
  auto y = ntt2.convolution(a, b);
  auto z = ntt3.convolution(a, b);
  vector<long long> ret(((long long)(x).size()));
  vector<pair<long long, long long> > mr(3);
  for (long long i = 0; i < (((long long)(x).size())); i++) {
    mr[0].first = ntt1.get_mod(), mr[0].second = (long long)x[i];
    mr[1].first = ntt2.get_mod(), mr[1].second = (long long)y[i];
    mr[2].first = ntt3.get_mod(), mr[2].second = (long long)z[i];
    ret[i] = garner(mr, mod);
  }
  return ret;
}
vector<long long> fast_llmod_convolution(vector<long long> a,
                                         vector<long long> b, long long mod) {
  for (auto& x : a) x %= mod;
  for (auto& x : b) x %= mod;
  NTT<167772161, 3> ntt1;
  NTT<469762049, 3> ntt2;
  NTT<1224736769, 3> ntt3;
  assert(ntt1.get_mod() < ntt2.get_mod() && ntt2.get_mod() < ntt3.get_mod());
  auto x = ntt1.convolution(a, b);
  auto y = ntt2.convolution(a, b);
  auto z = ntt3.convolution(a, b);
  const long long m1 = ntt1.get_mod(), m2 = ntt2.get_mod(), m3 = ntt3.get_mod();
  const long long m1_inv_m2 = mod_inv<long long>(m1, m2);
  const long long m12_inv_m3 = mod_inv<long long>(m1 * m2, m3);
  const long long m12_mod = m1 * m2 % mod;
  vector<long long> ret(((long long)(x).size()));
  for (long long i = 0; i < (((long long)(x).size())); i++) {
    long long v1 = (y[i] - x[i]) * m1_inv_m2 % m2;
    if (v1 < 0) v1 += m2;
    long long v2 = (z[i] - (x[i] + m1 * v1) % m3) * m12_inv_m3 % m3;
    if (v2 < 0) v2 += m3;
    long long constants3 = (x[i] + m1 * v1 + m12_mod * v2) % mod;
    if (constants3 < 0) constants3 += mod;
    ret[i] = constants3;
  }
  return ret;
}
long long POLYNOMIAL_MAX = INF;
long long POLYNOMIAL_MOD = 1000000007;
struct Polynomial {
  vector<long long> d;
  Polynomial(const vector<long long>& d) : d(d) {}
  Polynomial operator*(const Polynomial& x) {
    vector<long long> ans = fast_llmod_convolution(d, x.d, POLYNOMIAL_MOD);
    if ((long long)ans.size() > POLYNOMIAL_MAX + 1)
      ans.resize(POLYNOMIAL_MAX + 1);
    return Polynomial(ans);
  }
  void operator*=(const Polynomial& x) { d = operator*(x).d; }
};
long long n, k, a;
int main() {
  scanf("%lld%lld", &n, &k);
  POLYNOMIAL_MAX = k + 1;
  vector<long long> temp;
  temp.push_back(1);
  Polynomial ans(temp);
  for (long long i = 0; i < n; i++) {
    scanf("%lld", &a);
    vector<long long> t(a + 1, 1);
    ans *= Polynomial(t);
  }
  printf("%lld\n", ans.d[k]);
}
