#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int N, K;
int arr[105];
int dp[105][100005];
int solve(int i, int k) {
  int &ret = dp[i][k];
  if (ret != -1) return ret;
  if (i == N && k > 0) return 0;
  if (k == 0) return 1;
  if (k < 0) return 0;
  ret = 0;
  for (int val = 0; val <= arr[i]; val++) {
    if (k - val >= 0) {
      ret = ret + solve(i + 1, k - val);
      ret %= MOD;
    }
  }
  return ret;
}
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> arr[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(0, K);
}
