#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = 0;
      for (int curr = 0; curr <= a[i]; curr++) {
        if (j >= curr) dp[i][j] += dp[i + 1][j - curr];
        if (dp[i][j] >= (int)(1e9 + 7)) dp[i][j] -= (int)(1e9 + 7);
      }
    }
  }
  cout << dp[0][k] << endl;
}
