#include <bits/stdc++.h>
using namespace std;
long long dp[100][100001];
long long c[100] = {0};
long long N;
long long solve(long long *a, long long k, long long i) {
  long long t = 0, l = 0;
  if ((c[i] - a[i]) - k >= 0) {
    l = 0;
  } else {
    l = k - (c[i] - a[i]);
  }
  if (i == N - 1) {
    if (k <= a[i])
      t = 1;
    else
      t = 0;
  } else {
    for (long long j = l; j <= a[i] && j <= k; j++) {
      if (dp[i][k - j] != 0) {
        t = (t + dp[i][k - j]) % 1000000007;
      } else {
        dp[i][k - j] = solve(a, k - j, i + 1) % 1000000007;
        t = (t + dp[i][k - j]) % 1000000007;
      }
    }
  }
  return t;
}
signed main() {
  long long n, k;
  cin >> n >> k;
  long long a[n], cot = 0, t = 0;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = n - 1; i >= 0; i--) {
    t += a[i];
    c[i] = t;
  }
  N = n;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= a[i]; j++) {
      dp[i][j] = 0;
    }
  }
  cot = solve(a, k, 0);
  cout << cot << endl;
}
