#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
deque<long long> sol, sag;
long long dp[101][100005];
long long chd[105];
int n, k;
int dpa(int curn, int used) {
  if (curn == n && used == k) {
    return 1;
  }
  if (curn >= n || used > k) {
    return 0;
  }
  if (dp[curn][used] != -1) {
    return dp[curn][used];
  }
  dp[curn][used] = 0;
  for (int ij = 0; ij <= chd[curn]; ++ij) {
    dp[curn][used] = (dp[curn][used] + dpa(curn + 1, used + ij) % MOD) % MOD;
  }
  return dp[curn][used];
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> chd[i];
  }
  cout << dpa(0, 0);
  return 0;
}
