#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int dp[105][100005], prefix[105][100005], a[105];
inline int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int j = 0; j <= k; j++) dp[0][j] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      int first = (j - a[i] - 1) ? prefix[i - 1][j - a[i] - 1] : 0;
      int last = prefix[i - 1][j];
      dp[i][j] = add(dp[i][j], sub(last, first));
      prefix[i][j] = add(prefix[i][j - 1], dp[i][j]);
    }
  }
  cout << dp[n][k] << endl;
}
