#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E16;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long &pos, long long val) { pos = max(pos, val); }
void Min(long long &pos, long long val) { pos = min(pos, val); }
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
template <class T, class S>
inline bool chmax(T &a, S b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class S>
inline bool chmin(T &a, S b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
void mod_print(long long k) {
  long long P = 50000;
  for (long long y = 1; y <= P; y++) {
    long long x = mod(y * k);
    if (abs(x) <= P || x + P >= (long long)(1E9 + 7)) {
      if (x + P >= (long long)(1E9 + 7)) {
        x -= (long long)(1E9 + 7);
      }
      cout << x << "/" << y << "\n";
      return;
    }
  }
  cout << "nun"
       << "\n";
}
template <const long long md>
struct ntt {
  inline void add(long long &a, long long b) {
    a += b;
    if (a >= md) a -= md;
  }
  inline void sub(long long &a, long long b) {
    a -= b;
    if (a < 0) a += md;
  }
  inline long long add2(long long a, long long b) {
    a += b;
    if (a >= md) a -= md;
    return a;
  }
  inline long long sub2(long long a, long long b) {
    a -= b;
    if (a < 0) a += md;
    return a;
  }
  inline long long mul(long long a, long long b) {
    return (long long)((long long)a * b % md);
  }
  inline long long power(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
      if (b & 1) res = mul(res, a);
      a = mul(a, a);
      b >>= 1;
    }
    return res;
  }
  inline long long inv(long long a) {
    a %= md;
    if (a < 0) a += md;
    long long b = md, u = 0, v = 1;
    while (a) {
      long long t = b / a;
      b -= t * a;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    assert(b == 1);
    if (u < 0) u += md;
    return u;
  }
  long long max_base, root;
  vector<long long> dw, idw;
  ntt() {
    long long tmp = md - 1;
    max_base = 0;
    while (tmp % 2 == 0) {
      tmp /= 2;
      max_base++;
    }
    root = 2;
    while (power(root, (md - 1) >> 1) == 1) root++;
    dw.resize(max_base);
    idw.resize(max_base);
    for (long long i = 0; i <= max_base - 1; i++) {
      sub(dw[i], power(root, (md - 1) >> (i + 2)));
      idw[i] = inv(dw[i]);
    }
  }
  void fft(vector<long long> &a, bool inv) {
    const long long n = a.size();
    assert((n & (n - 1)) == 0);
    assert(__builtin_ctz(n) <= max_base);
    if (!inv) {
      for (long long m = n; m >>= 1;) {
        long long w = 1;
        for (long long s = 0, k = 0; s < n; s += 2 * m) {
          for (long long i = s, j = s + m; i < s + m; ++i, ++j) {
            long long x = a[i], y = mul(a[j], w);
            a[j] = (x >= y ? x - y : x + md - y);
            a[i] = (x + y >= md ? x + y - md : x + y);
          }
          w = mul(w, dw[__builtin_ctz(++k)]);
        }
      }
    } else {
      for (long long m = 1; m < n; m *= 2) {
        long long w = 1;
        for (long long s = 0, k = 0; s < n; s += 2 * m) {
          for (long long i = s, j = s + m; i < s + m; ++i, ++j) {
            long long x = a[i], y = a[j];
            a[j] = (x >= y ? x - y : x + md - y);
            a[j] = mul(a[j], w);
            a[i] = (x + y >= md ? x + y - md : x + y);
          }
          w = mul(w, idw[__builtin_ctz(++k)]);
        }
      }
    }
  }
  vector<long long> multiply(vector<long long> a, vector<long long> b,
                             long long eq = 0) {
    long long need = a.size() + b.size() - 1;
    long long nbase = 0;
    while ((1 << nbase) < need) nbase++;
    long long sz = 1 << nbase;
    a.resize(sz);
    b.resize(sz);
    fft(a, 0);
    if (eq)
      b = a;
    else
      fft(b, 0);
    long long inv_sz = inv(sz);
    for (long long i = 0; i < sz; i++) {
      a[i] = mul(mul(a[i], b[i]), inv_sz);
    }
    fft(a, 1);
    a.resize(need);
    return a;
  }
  vector<long long> square(vector<long long> a) { return multiply(a, a, 1); }
};
long long LIMIT;
template <const long long md>
vector<long long> anyntt(vector<long long> &a, vector<long long> &b,
                         long long eq = 0) {
  for (auto &x : a)
    if (x < 0) x = mod(x);
  for (auto &x : b)
    if (x < 0) x = mod(x);
  const long long m1 = 167772161, m2 = 469762049, m3 = 754974721;
  ntt<m1> n1;
  ntt<m2> n2;
  ntt<m3> n3;
  ntt<md> nn;
  auto a1 = n1.multiply(a, b, eq);
  auto a2 = n2.multiply(a, b, eq);
  auto a3 = n3.multiply(a, b, eq);
  const long long n = a1.size();
  vector<long long> ret(n);
  vector<long long> m;
  m = {m1, m2, m3};
  vector<long long> r;
  r = {1, n2.inv(m1), n3.inv(n3.mul(m1, m2))};
  long long mm = nn.mul(m1, m2);
  for (long long i = 0; i <= n - 1; i++) {
    n2.add(a2[i], n2.sub2(m2, a1[i]));
    long long v1 = n2.mul(a2[i], r[1]);
    n3.add(a3[i], n3.sub2(m3, n3.add2(a1[i], n3.mul(m1, v1))));
    long long v2 = n3.mul(a3[i], r[2]);
    nn.add(a1[i], nn.add2(nn.mul(m1, v1), nn.mul(mm, v2)));
    ret[i] = a1[i];
  }
  while (ret.size() > LIMIT + 1) {
    ret.pop_back();
  }
  return ret;
}
long long po(long long i, long long p) {
  if (p == 0)
    return 1;
  else {
    i = mod(i);
    if (p == 1) return i;
    if (p % 2 == 0) return po(mod(i * i), p / 2);
    return mod(i * po(i, p - 1));
  }
}
long long bunbo(long long n) { return po(n, (long long)(1E9 + 7) - 2); }
long long coef_of_generating_function(vector<long long> P, vector<long long> Q,
                                      long long n) {
  for (auto &x : P)
    if (x < 0) x = mod(x);
  for (auto &x : Q)
    if (x < 0) x = mod(x);
  long long z = Q[0];
  long long bz = bunbo(z);
  for (auto &x : P) x = mod(x * bz);
  for (auto &x : Q) x = mod(x * bz);
  long long sp = P.size(), sq = Q.size();
  for (long long zz = 1; zz <= sq - sp - 1; zz++) P.push_back(0);
  while (n > 0) {
    vector<long long> Q1(Q.size());
    for (long long i = 0; i <= Q.size() - 1; i++) {
      if (i % 2 == 0) {
        Q1[i] = Q[i];
      } else {
        Q1[i] = mod(-Q[i]);
      }
    }
    auto np = anyntt<(long long)(long long)(1E9 + 7)>(P, Q1);
    auto nq = anyntt<(long long)(long long)(1E9 + 7)>(Q, Q1);
    P.clear();
    Q.clear();
    for (long long i = n & 1; i <= np.size() - 1; i += 2) P.push_back(np[i]);
    for (long long i = 0; i <= nq.size() - 1; i += 2) Q.push_back(nq[i]);
    n /= 2;
  }
  return P[0];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  LIMIT = k;
  long long a[n];
  for (long long i = 0; i <= n - 1; i++) cin >> a[i];
  vector<long long> dp(1);
  dp[0] = 1;
  for (long long i = 0; i <= n - 1; i++) {
    vector<long long> t(a[i] + 2);
    t[0] = 1;
    t[a[i] + 1] = -1;
    dp = anyntt<(long long)(1E9 + 7)>(dp, t);
  }
  for (long long zz = 1; zz <= n; zz++) {
    for (long long i = 1; i <= min(dp.size() - 1, k); i++) {
      Add(dp[i], dp[i - 1]);
    }
  }
  cout << mod(dp[k]) << "\n";
  return 0;
}
