#include <bits/stdc++.h>
using namespace std;
long long n, i, j, ans = 0, k;
long long a[1000], dp[100 + 3][100000 + 9];
long long M = (long long)1E9 + 7;
long long f(long long st, long long choc) {
  if (st > n) {
    if (choc == 0)
      return 1;
    else
      return 0;
  }
  if (dp[st][choc] != -1) return dp[st][choc];
  dp[st][choc] = 0;
  for (int i = 0; i <= min(a[st], choc); i++)
    dp[st][choc] = (dp[st][choc] + f(st + 1, choc - i) + M) % M;
  return dp[st][choc] % M;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) cin >> a[i];
  cout << f(1, k) << endl;
}
