#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
const long long mod = 1e9 + 7;
long long power(long long x, long long n, long long mod) {
  long long res = 1;
  x %= mod;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
long long f(long long si, long long n, long long k, long long arr[]) {
  if (dp[si][k] != -1) return dp[si][k];
  if (si == n && k > arr[si])
    return 0;
  else if (si == n)
    return 1;
  long long ans = 0;
  for (long long i = 0; i <= min(arr[si], k); i++) {
    if (dp[si + 1][k - i] == -1) dp[si + 1][k - i] = f(si + 1, n, k - i, arr);
    ans = (ans + dp[si + 1][k - i]) % mod;
  }
  return ans;
}
signed main() {
  long long 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));
  long long arr[n + 1];
  for (i = 1; i <= n; i++) cin >> arr[i];
  cout << f(1, n, k, arr);
}
