#include <bits/stdc++.h>
using namespace std;
int mod(const int& a) { return a % 1000000007; }
int main() {
  int n, k;
  cin >> n >> k;
  int a[100];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i + 1];
    cnt += a[i + 1];
  }
  int dp[101][100001] = {};
  dp[0][0] = 1;
  int mx = 0;
  int d = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = max(k - cnt, 0); j <= mx + a[i] && j <= k; j++) {
      for (int l = 0; l <= a[i]; l++) {
        if (j - l < 0) break;
        dp[i][j] = mod(dp[i][j] += dp[i - 1][j - l]);
      }
      d = j;
    }
    cnt -= a[i];
    mx = d;
  }
  cout << dp[n][k] << endl;
}
