#include <bits/stdc++.h>
using namespace std;
long long int dp[105][100005], cp[105][100005];
int main() {
  long long int n, k, s = 0, l = 1000000007;
  cin >> n >> k;
  long long int a[n], i, j;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
    s += a[i];
  }
  if (s < k) {
    cout << "0";
    return 0;
  }
  for (j = 0; j <= a[0]; ++j) {
    dp[0][j] = 1;
    cp[0][j] = 1;
  }
  for (j = 1; j <= 100000; ++j) {
    cp[0][j] = (cp[0][j] + cp[0][j - 1]) % l;
  }
  for (i = 1; i < n; ++i) {
    for (j = 0; j <= a[i]; ++j) {
      dp[i][j] = (dp[i - 1][j]) % l;
      cp[i][j] = (dp[i - 1][j]) % l;
    }
    for (j = 1; j <= a[i]; ++j) {
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % l;
      cp[i][j] = (cp[i][j] + cp[i][j - 1]) % l;
    }
    for (j = a[i] + 1; j <= 100000; ++j) {
      dp[i][j] = (cp[i - 1][j] - cp[i - 1][j - a[i] - 1]) % l;
      cp[i][j] = (dp[i][j]) % l;
    }
    for (j = 1; j <= 100000; ++j) cp[i][j] = (cp[i][j] + cp[i][j - 1]) % l;
  }
  cout << dp[n - 1][k];
  return 0;
}
