#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
signed main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  static long long dp[101][100001 * 3];
  dp[0][0] = 1;
  for (long long i = 0; i < n; i++) {
    vector<long long> dp2(k + 1, 0);
    for (long long j = 0; j <= k; j++) {
      dp2[j + 1] = (dp2[j] + dp[i][j]) % MOD;
    }
    for (long long j = 0; j <= k; j++) {
      dp[i + 1][j] += dp2[j + 1] - dp2[max(0LL, j - a[i])] + MOD;
      dp[i + 1][j] %= MOD;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
