#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int MAX_N = 500010;
const long long int INF = 9999999999;
long long int dp[110][MAX_N];
int main() {
  int n, k;
  cin >> n >> k;
  int s = 100010;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i][j] = 0;
    }
  }
  dp[0][s] = 1;
  vector<int> a(n + 2);
  vector<int> b(n + 2);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i][j] = 0;
    }
  }
  for (int j = s; j <= s + k; j++) {
    if (j - s <= a[1]) {
      b[j] = 1;
    } else {
      b[j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = s; j <= s + k; j++) {
      dp[i][j] = b[j];
      b[j] = (b[j - 1] + dp[i][j] - dp[i][j - a[i + 1] - 1]) % MOD;
    }
  }
  cout << dp[n][s + k] << endl;
}
