#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
int n;
int dp[105][N];
int arr[105];
int add(int a, int b) {
  while (a < 0) {
    a += mod;
  }
  while (b < 0) {
    b += mod;
  }
  return (a + b) % mod;
}
void solve() {
  for (int i = 0; i < N; i++) dp[n][i] = 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < N; j++) {
      int st = j, en = j - min(arr[i], j);
      if (en)
        dp[i][j] = add(dp[i + 1][st], -dp[i + 1][en - 1]);
      else
        dp[i][j] = dp[i + 1][st];
      if (j) dp[i][j] = add(dp[i][j], dp[i][j - 1]);
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  solve();
  if (k)
    cout << dp[0][k] - dp[0][k - 1];
  else
    cout << dp[0][0];
  return 0;
}
