#include <bits/stdc++.h>
using namespace std;
long long fun(long long i, long long sum, long long n, long long a[]) {
  long long dp[n + 1][sum + 1], j, k;
  for (i = 0; i <= sum; i++) dp[0][i] = 0;
  for (i = 0; i <= n; i++) dp[i][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= sum; j++) {
      dp[i][j] = 0;
      dp[i][j] += dp[i - 1][j];
      dp[i][j] %= 1000000007;
      for (k = 1; k <= a[i - 1]; k++) {
        if (j - k >= 0) {
          dp[i][j] += dp[i - 1][j - k];
          dp[i][j] %= 1000000007;
        }
      }
    }
  }
  return dp[n][sum] % 1000000007;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k, i, s;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
  }
  if (s < k)
    cout << "0" << endl;
  else {
    cout << fun(0, k, n, a) % 1000000007 << endl;
  }
  return 0;
}
