#include <bits/stdc++.h>
using namespace std;
const int MX = 100000;
const long long mod = 1e9 + 7;
long long dp[105][MX + 5];
long long a[105];
int n;
long long solve(int k) {
  ++k;
  dp[n + 1][1] = 1;
  for (int i = 2; i <= k; i++) dp[n + 1][i] += dp[n + 1][i - 1];
  for (int i = n; i >= 1; i--) {
    int x = a[i];
    for (int j = 1; j <= k; j++) {
      int y = max(1, j - x);
      y--;
      dp[i][j] = (dp[i + 1][j] - dp[i + 1][y]) % mod;
    }
    for (int j = 1; j <= k; j++) {
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
    }
  }
  return dp[1][k] - dp[1][k - 1];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long res = solve(k);
  cout << res << endl;
  return 0;
}
