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