#include <bits/stdc++.h>
using namespace std;
const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
struct mint {
  long long x;
  mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
long long extGCD(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long d = extGCD(b, a % b, y, x);
  y -= a / b * x;
  return d;
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
template <typename T>
map<T, int> compress(vector<T> x) {
  map<T, int> res;
  sort(x.begin(), x.end());
  x.erase(unique(x.begin(), x.end()), x.end());
  for (int i = 0; i < x.size(); i++) {
    res[x[i]] = i;
  }
  return res;
}
template <typename T>
int former(const vector<T>& v, T x) {
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template <typename T>
int latter(const vector<T>& v, T x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
template <typename T>
using vec = vector<T>;
template <typename T>
using vvec = vector<vector<T>>;
using ll = long long;
using Pli = pair<long long, int>;
using Pll = pair<long long, long long>;
int main() {
  int N, K;
  cin >> N >> K;
  vec<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vec<mint> dp(K + 1, 0);
  dp[0] = 1;
  for (auto a : A) {
    for (int i = a + 1; i < dp.size(); i++) dp[i] -= dp[i - (a + 1)];
  }
  for (int _ = 0; _ < N; _++) {
    for (int i = 0; i < K; i++) dp[i + 1] += dp[i];
  }
  cout << dp[K] << endl;
  return 0;
}
