#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
const int MOD = 1e9 + 7;
int dp[100005];
int a[MAXN];
void tambah(int& a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
void kurang(int& a, int b) {
  a -= b;
  if (a < 0) a += MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    vector<int> pref(k + 1);
    for (int candy = k; candy >= 0; candy--) {
      int l = candy + 1;
      int r = candy + a[i];
      r = r > k ? k : r;
      tambah(pref[l], dp[candy]);
      if (r + 1 <= k) kurang(pref[r + 1], dp[candy]);
    }
    int sum_now = 0;
    for (int i = 0; i <= k; i++) {
      tambah(sum_now, pref[i]);
      tambah(dp[i], sum_now);
    }
  }
  cout << dp[k] << '\n';
  return 0;
}
