#include <bits/stdc++.h>
using namespace std;
long long n, k, dp[105][100005], sum, a[100005], yo, pt;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    sum = 0;
    yo += a[i];
    pt = 0;
    for (int j = 0; j <= min(yo, k); j++) {
      sum += dp[i - 1][j];
      dp[i][j] = sum;
      dp[i][j] %= (int)1e9 + 7;
      while (pt + a[i] <= j) {
        sum -= dp[i - 1][pt];
        pt++;
      }
      if (sum < 0) sum += (int)1e9 + 7;
    }
  }
  cout << dp[n][k] << "\n";
  return 0;
}
