#include <bits/stdc++.h>
using namespace std;
struct IoSetup {
  IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
} IoSetup;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
static constexpr const signed int dy[] = {0, -1, 0, 1, -1, 1, -1, 1};
inline bool inside(int x, int y, int w, int h) {
  return (x >= 0 && y >= 0 && x < w && y < h);
}
template <class T>
bool chmax(T &a, const T &b) {
  return (a = max(a, b)) == b;
}
template <class T>
bool chmin(T &a, const T &b) {
  return (a = min(a, b)) == b;
}
inline int qp(int a, long long b, int mo) {
  int ans = 1;
  do {
    if (b & 1) ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}
int n;
int k;
int a[110];
int dp[110][100100];
int sum[100100];
signed main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      sum[j + 1] = sum[j] + dp[i][j];
      dp[i + 1][j] = (sum[j + 1] - sum[max(0, j - a[i])]) % SMOD;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
