#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int n, k;
int v[101];
int dp[101][100001];
int sum[101][100001];
int fun(int ind, int lim) {
  if (lim == 0) {
    return 1;
  }
  if (lim < 0 || ind >= n) {
    return 0;
  }
  int ans = 0;
  for (int i = min(lim, v[ind]); i > -1; i--) {
    if (sum[ind + 1][lim - i] != -1) {
      ans = (ans + (sum[ind + 1][lim - i])) % 1000000007;
      break;
    }
    if (dp[ind + 1][lim - i] == -1) {
      dp[ind + 1][lim - i] = fun(ind + 1, lim - i) % 1000000007;
    }
    sum[ind + 1][lim] += dp[ind + 1][lim - i];
    ans = (ans + (dp[ind + 1][lim - i])) % 1000000007;
  }
  return dp[ind][lim] = ans;
}
void solve() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < n + 1; i++) {
    for (int j = 0; j < k + 1; j++) {
      dp[i][j] = -1;
      sum[i][j] = -1;
    }
  }
  cout << fun(0, k);
}
int main() {
  fast();
  solve();
}
