#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100;
const int MAX_M = 100000;
int n, m;
int dp[MAX_N + 1][MAX_M + 1];
int a[MAX_N];
const int M = 1000000007;
void solve() {
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= m; j++) {
      if (dp[i][j] == 0) break;
      for (int k = 0; k <= a[i]; k++) {
        if (j + k <= m) {
          dp[i + 1][j + k] += dp[i][j];
          dp[i + 1][j + k] %= M;
        }
      }
    }
  }
  cout << dp[n][m] << endl;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  solve();
  return 0;
}
