#include <bits/stdc++.h>
long long MOD = 1e9 + 7;
using namespace std;
long long dp[101][100005];
long long cum[101][100005];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i <= k; ++i) cum[0][i] = 1;
  int a;
  int sum = 0;
  vector<int> vec(n);
  for (int i = 1; i <= n; ++i) {
    cin >> a;
    sum += a;
    for (int j = 0; j <= k; ++j) {
      if (j <= sum) {
        int b = j - a;
        if (b <= 0)
          dp[i][j] = cum[i - 1][j];
        else
          dp[i][j] = cum[i - 1][j] - cum[i - 1][b - 1];
      }
      cum[i][j] = dp[i][j];
      if (j > 0) cum[i][j] = (cum[i][j] % MOD + cum[i][j - 1] % MOD) % MOD;
    }
  }
  cout << dp[n][k] << endl;
}
