#include <bits/stdc++.h>
using namespace std;
int dp[100009][101], arr[102], MOD = 1e9 + 7;
int solve(int sum, int n) {
  if (sum == 0) return 1;
  if (n == 0 || sum < 0) return 0;
  if (dp[sum][n] != -1)
    return dp[sum][n];
  else {
    int temp = 0;
    for (int x = 0; x <= arr[n]; x++)
      temp = ((temp % MOD) + (solve(sum - x, n - 1) % MOD)) % MOD;
    dp[sum][n] = temp;
  }
  return dp[sum][n];
}
int main() {
  int n, k;
  memset(dp, -1, sizeof dp);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  cout << solve(k, n) << endl;
  return 0;
}
