#include <bits/stdc++.h>
using namespace std;
int const MAXN = 110, MAXK = 100100, M = 1000000007;
int n, k, c[MAXN], memo[MAXN][MAXK];
bool done[MAXN][MAXK];
int dp(int i, int k) {
  if (done[i][k]) return memo[i][k];
  done[i][k] = true;
  if (i == n - 1) {
    if (k >= 0 && k <= c[i]) return memo[i][k] = 1;
    return memo[i][k] = -42;
  }
  int res = 0;
  for (int x = 0; x <= min(k, c[i]); x++) {
    int current = (done[i + 1][k - x]) ? memo[i + 1][k - x] : dp(i + 1, k - x);
    if (current != -42) {
      res += current;
      res %= M;
    }
  }
  return memo[i][k] = res;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> c[i];
  cout << max(0, dp(0, k));
}
