#include <bits/stdc++.h>
using namespace std;
int dp[101][100001];
const int mod = 1e9 + 7;
int power(int x, int n, int mod) {
  int res = 1;
  x %= mod;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
int f(int n, int k, int arr[]) {
  if (n == 1 && k > arr[n]) return 0;
  if (n == 1) return 1;
  if (dp[n][k] != -1) return dp[n][k];
  int ans = 0;
  for (int i = 0; i <= min(arr[n], k); i++) {
    if (dp[n - 1][k - i] == -1) dp[n - 1][k - i] = f(n - 1, k - i, arr);
    ans = (ans + dp[n - 1][k - i]) % mod;
  }
  dp[n][k] = ans;
  return dp[n][k];
}
signed main() {
  int a = 0, b = 0, c = 0, d = 0, i = 0, j = 0, k = 0, t = 0, n = 0, q = 0;
  cin >> n >> k;
  memset(dp, -1, sizeof(dp));
  int arr[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  cout << f(n, k, arr);
}
