#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long a[101];
long long pre[101];
long long dp[101][100001];
long long func(long long i, long long j) {
  if (i < 0 || j < 0) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  if (pre[i] < j) return dp[i][j] = func(i, j - 1);
  if (i == 0 || j == 0) {
    if (i == 0) {
      return dp[i][j] = min(j + 1, a[i] + 1);
    }
    if (j == 0) {
      return dp[i][j] = 1;
    }
  }
  dp[i][j] = (func(i, j - 1) + func(i - 1, j) - func(i - 1, j - a[i] - 1)) %
             1000000007;
  return dp[i][j];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  cin >> a[0];
  pre[0] = a[0];
  for (long long i = 1; i < n; i++) {
    cin >> a[i];
    pre[i] = pre[i - 1] + a[i];
  }
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < k + 1; j++) dp[i][j] = -1;
  cout << (func(n - 1, k) - func(n - 1, k - 1)) % 1000000007 << endl;
  return 0;
}
