#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const long long INFL = 9223372036854775807LL / 10;
const int INFI = 2147483647 / 10;
int N, K;
int a[100];
const int limit_K = 1e5 + 1;
long long old_dp[limit_K];
long long dp[limit_K];
int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> K;
  for (int i = (0); i < (N); ++i) {
    int aa;
    cin >> aa;
    a[i] = aa;
  }
  for (int i = (0); i < (K + 1); ++i) {
    dp[i] = i <= a[0] ? 1 : 0;
  }
  for (int n = (1); n < (N); ++n) {
    memcpy(old_dp, dp, sizeof(dp));
    long long ans = 0;
    for (int k = (0); k < (K + 1); ++k) {
      if (k - a[n] <= 0) {
        ans = (ans + old_dp[a[n] - k]) % mod;
      }
      dp[k] = ans;
    }
  }
  cout << dp[K] << endl;
}
