#include <bits/stdc++.h>
using namespace std;
int dp[100005][105];
int n, k;
int arr[105];
const int MOD = 1e9 + 7;
int sol(int n, int k) {
  if (n == 0) {
    if (k == 0) return 1;
    return 0;
  }
  if (dp[n][k] != -1) return dp[n][k];
  int res = 0;
  for (int j = 0; j <= arr[n]; j++) res = (res + sol(n - 1, k - j)) % MOD;
  return dp[n][k] = res;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < 100005; i++)
    for (int j = 0; j < 105; j++) dp[i][j] = -1;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  dp[0][0];
  cout << sol(n, k);
}
