#include <bits/stdc++.h>
using namespace std;
const long long d = 1000000007;
int dp[105][100005];
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (int i = 0; i <= k; i++) {
    dp[0][i] = 1;
  }
  for (int j = 1; j <= n; j++) {
    for (int x = 1; x <= k; x++) {
      int f = min(x - a[j], 0);
      long long value = 0;
      value += dp[j - 1][x];
      if (f != 0) {
        value -= dp[j - 1][f - 1];
      }
      dp[j][x] = (int)((value + d) % d);
    }
    if (j == n) {
      break;
    }
    long long sum = dp[j][0];
    for (int x = 1; x <= k; x++) {
      sum = sum + dp[j][x];
      sum = (sum + d) % d;
      dp[j][x] = sum;
    }
  }
  cout << dp[n][k] - dp[n][k - 1];
  return 0;
}
