#include <bits/stdc++.h>
using namespace std;
int n, k, dp[109][100009], mod = 1e9 + 7, a[109];
int bt(int id, int x) {
  if (id == n) {
    if (x == 0)
      return 1;
    else
      return 0;
  }
  if (dp[id][x] != -1) return dp[id][x];
  dp[id][x] = 0;
  for (int i = 0; i <= a[id] && i <= x; i++) {
    dp[id][x] += bt(id + 1, x - i);
    dp[id][x] %= mod;
  }
  return dp[id][x];
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  cout << bt(0, k);
}
