#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
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 <int mod, int primitive_root>
class NTT {
 public:
  int get_mod() const { return mod; }
  void _ntt(vector<long long>& a, int sign) {
    const int n = ((int)(a).size());
    const int g = 3;
    int h = (int)mod_pow(g, (mod - 1) / n, mod);
    if (sign == -1) h = (int)mod_inv(h, mod);
    int i = 0;
    for (int j = 1; j < n - 1; ++j) {
      for (int k = n >> 1; k > (i ^= k); k >>= 1)
        ;
      if (j < i) swap(a[i], a[j]);
    }
    for (int m = 1; m < n; m *= 2) {
      const int m2 = 2 * m;
      const long long base = mod_pow(h, n / m2, mod);
      long long w = 1;
      for (int x = 0; x < (m); x++) {
        for (int 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 intt(vector<long long>& input) {
    _ntt(input, -1);
    const int n_inv = mod_inv(((int)(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) {
    int ntt_size = 1;
    while (ntt_size < ((int)(a).size()) + ((int)(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 (int i = 0; i < (ntt_size); i++) {
      (_a[i] *= _b[i]) %= mod;
    }
    intt(_a);
    return _a;
  }
};
long long garner(vector<pair<int, int> > mr, int mod) {
  mr.emplace_back(mod, 0);
  vector<long long> coffs(((int)(mr).size()), 1);
  vector<long long> constants(((int)(mr).size()), 0);
  for (int i = 0; i < (((int)(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 (int j = i + 1; j < ((int)(mr).size()); j++) {
      (constants[j] += coffs[j] * v) %= mr[j].first;
      (coffs[j] *= mr[i].first) %= mr[j].first;
    }
  }
  return constants[((int)(mr).size()) - 1];
}
vector<long long> int32mod_convolution(vector<long long> a, vector<long long> b,
                                       int 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(((int)(x).size()));
  vector<pair<int, int> > mr(3);
  for (int i = 0; i < (((int)(x).size())); i++) {
    mr[0].first = ntt1.get_mod(), mr[0].second = (int)x[i];
    mr[1].first = ntt2.get_mod(), mr[1].second = (int)y[i];
    mr[2].first = ntt3.get_mod(), mr[2].second = (int)z[i];
    ret[i] = garner(mr, mod);
  }
  return ret;
}
vector<long long> fast_int32mod_convolution(vector<long long> a,
                                            vector<long long> b, int 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);
  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(((int)(x).size()));
  for (int i = 0; i < (((int)(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;
}
template <typename T>
struct FormalPowerSeries {
  using Poly = vector<T>;
  using Conv = function<Poly(Poly, Poly, int)>;
  Conv conv;
  FormalPowerSeries(Conv conv) : conv(conv) {}
  Poly pre(const Poly& as, int deg) {
    return Poly(as.begin(), as.begin() + min((int)as.size(), deg));
  }
  Poly add(Poly as, Poly bs) {
    int sz = max(as.size(), bs.size());
    Poly cs(sz, T(0));
    for (int i = 0; i < (int)as.size(); i++) cs[i] += as[i];
    for (int i = 0; i < (int)bs.size(); i++) cs[i] += bs[i];
    return cs;
  }
  Poly sub(Poly as, Poly bs) {
    int sz = max(as.size(), bs.size());
    Poly cs(sz, T(0));
    for (int i = 0; i < (int)as.size(); i++) cs[i] += as[i];
    for (int i = 0; i < (int)bs.size(); i++) cs[i] -= bs[i];
    return cs;
  }
  Poly mul(Poly as, Poly bs) { return conv(as, bs, 1e9 + 7); }
  Poly mul(Poly as, T k) {
    for (auto& a : as) a *= k;
    return as;
  }
  Poly inv(Poly as, int deg) {
    Poly rs({T(1) / as[0]});
    for (int i = 1; i < deg; i <<= 1)
      rs = pre(sub(add(rs, rs), mul(mul(rs, rs), pre(as, i << 1))), i << 1);
    return rs;
  }
  Poly div(Poly as, Poly bs) {
    while (as.back() == T(0)) as.pop_back();
    while (bs.back() == T(0)) bs.pop_back();
    if (bs.size() > as.size()) return Poly();
    reverse(as.begin(), as.end());
    reverse(bs.begin(), bs.end());
    int need = as.size() - bs.size() + 1;
    Poly ds = pre(mul(as, inv(bs, need)), need);
    reverse(ds.begin(), ds.end());
    return ds;
  }
  Poly sqrt(Poly as, int deg) {
    T inv2 = T(1) / T(2);
    Poly ss({T(1)});
    for (int i = 1; i < deg; i <<= 1) {
      ss = pre(add(ss, mul(pre(as, i << 1), inv(ss, i << 1))), i << 1);
      for (T& x : ss) x *= inv2;
    }
    return ss;
  }
  Poly diff(Poly as) {
    int n = as.size();
    Poly rs(n - 1);
    for (int i = 1; i < n; i++) rs[i - 1] = as[i] * T(i);
    return rs;
  }
  Poly integral(Poly as) {
    int n = as.size();
    Poly rs(n + 1);
    rs[0] = T(0);
    for (int i = 0; i < n; i++) rs[i + 1] = as[i] / T(i + 1);
    return rs;
  }
  Poly log(Poly as, int deg) {
    return pre(integral(mul(diff(as), inv(as, deg))), deg);
  }
  Poly exp(Poly as, int deg) {
    Poly f({T(1)});
    as[0] += T(1);
    for (int i = 1; i < deg; i <<= 1)
      f = pre(mul(f, sub(pre(as, i << 1), log(f, i << 1))), i << 1);
    return f;
  }
  Poly partition(int n) {
    Poly rs(n + 1);
    rs[0] = T(1);
    for (int k = 1; k <= n; k++) {
      if (1LL * k * (3 * k + 1) / 2 <= n)
        rs[k * (3 * k + 1) / 2] += T(k % 2 ? -1LL : 1LL);
      if (1LL * k * (3 * k - 1) / 2 <= n)
        rs[k * (3 * k - 1) / 2] += T(k % 2 ? -1LL : 1LL);
    }
    return inv(rs, n + 1);
  }
  Poly bernoulli(int n) {
    Poly rs(n + 1, 1);
    for (int i = 1; i <= n; i++) rs[i] = rs[i - 1] / T(i + 1);
    rs = inv(rs, n + 1);
    T tmp(1);
    for (int i = 1; i <= n; i++) {
      tmp *= T(i);
      rs[i] *= tmp;
    }
    return rs;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  FormalPowerSeries<long long> fps(fast_int32mod_convolution);
  long long n, k;
  cin >> n >> k;
  vector<long long> res(1, 1);
  for (long long i = 0; i < (long long)(n); i++) {
    long long a;
    cin >> a;
    vector<long long> b(a + 1, 1);
    b.resize(k + 1);
    res = fps.mul(res, b);
    res.resize(k + 1);
  }
  cout << res[k] << endl;
  return 0;
}
