#include <bits/stdc++.h>
using namespace std;
int N, K;
int a[110];
const long long MOD = 1e9 + 7;
long long A[110];
long long dp[110][100010];
long long rec(int n, int k) {
  if (k == 0) return 1;
  if (n == 0 || k < 0) return 0;
  if (dp[n][k] != -1) return dp[n][k];
  long long res = rec(n - 1, k) + rec(n, k - 1) - rec(n - 1, k - a[n] - 1);
  return dp[n][k] = res % MOD;
}
int main() {
  cin >> N >> K;
  memset(dp, -1, sizeof(dp));
  memset(A, 0, sizeof(A));
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    A[i] += A[i - 1] + a[i];
  }
  if (K == 0 && A[N] == 0) {
    cout << 1 << endl;
    return 0;
  }
  cout << rec(N, K) << endl;
}
