#include <bits/stdc++.h>
using namespace std;
long long int n, k;
long long int a[105];
long long int dp[101][100005];
long long int rec(long long int i, long long int rem) {
  if (dp[i][rem] != -1) return dp[i][rem];
  if (i == n) {
    if (rem == 0) {
      return 1;
    }
    return 0;
  }
  long long int ans = 0;
  for (long long int j = 0; j <= a[i] && j <= rem; j++) {
    ans = (ans + (rec(i + 1, rem - j))) % 1000000007;
  }
  dp[i][rem] = ans;
  return dp[i][rem];
}
signed main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  rec(0, k);
  cout << dp[0][k] << endl;
  return 0;
}
