#include <bits/stdc++.h>
using namespace std;
long long int dp[101][100001];
long long int nn, a[101], k, mod = 1000000007;
void solve(long long int n, long long int m) {
  if (dp[n][m] != -1) {
    return;
  } else {
    dp[n][m] = 0;
  }
  if (m == 0) {
    dp[n][m] = 1;
    return;
  }
  if (n == nn - 1) {
    if (a[n] >= m) dp[n][m] = 1;
    return;
  }
  if (n >= nn || m < 0) {
    return;
  }
  if (m >= a[n] + 1) {
    solve(n, m - 1);
    solve(n + 1, m);
    solve(n + 1, m - a[n] - 1);
    dp[n][m] = dp[n][m - 1] + dp[n + 1][m] - dp[n + 1][m - a[n] - 1];
    dp[n][m] %= mod;
  } else {
    solve(n, m - 1);
    solve(n + 1, m);
    dp[n][m] = dp[n][m - 1] + dp[n + 1][m];
    dp[n][m] %= mod;
  }
  return;
}
int main() {
  cin >> nn >> k;
  for (int i = 0; i < 101; ++i) {
    for (int j = 0; j < 100001; ++j) {
      dp[i][j] = -1;
    }
  }
  for (int i = 0; i < nn; ++i) {
    cin >> a[i];
  }
  solve(0, k);
  cout << dp[0][k];
}
