#include <bits/stdc++.h>
using namespace std;
long long minn(long long x, long long y) {
  if (x < y) return x;
  return y;
}
long long maxx(long long x, long long y) {
  if (x > y) return x;
  return y;
}
long long dp[109][100009], dpp[109][100009], a[109];
long long get(long long n, long long k) {
  if (dpp[n][k] != -1) return dpp[n][k];
  if (k == 0) return dpp[n][0] = 1;
  dpp[n][k] = 0;
  if (n != 0) {
    for (int i = 0; i <= a[n] && i <= k; i++) {
      dpp[n][k] = (dpp[n][k] + get(n - 1, k - i)) % 1000000007;
    }
  }
  return dpp[n][k] % 1000000007;
}
int main() {
  long long n, k;
  cin >> n >> k;
  memset(dpp, -1, sizeof(dpp));
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j == 0 || i == 0) {
        dp[i][j] = 1;
        continue;
      }
      dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]);
      if (a[i] < j) {
        dp[i][j] -= dp[i - 1][j - a[i] - 1];
      }
      dp[i][j] %= 1000000007;
    }
  }
  cout << dp[n][k] - dp[n][k - 1];
}
