#include <bits/stdc++.h>
using namespace std;
int n;
int dp[100][100001];
int arr[100];
int solve(int pos, int req) {
  if (pos == n) {
    if (req == 0)
      return 1;
    else
      return 0;
  }
  if (dp[pos][req] != -1) return dp[pos][req];
  int res = 0;
  for (int i = 0; i <= min(arr[pos], req); i++) {
    res = (res + solve(pos + 1, (req - i))) % 1000000007;
  }
  return dp[pos][req] = res;
}
int main(void) {
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(0, k) << endl;
}
