#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<int> > dp(n, vector<int>(k + 1));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    dp[i][0] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      int s = 0;
      for (int x = 0; x <= a[i - 1]; x++) {
        if (j - x < 0) break;
        s = (s + dp[i - 1][j - x]) % 1000000007;
      }
      dp[i][j] = s;
    }
  }
  cout << dp[n - 1][k] << endl;
}
