#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> vec(n + 1, -1);
  for (int i = 1; i <= n; i++) cin >> vec[i];
  vector<vector<int> > dp(n + 1, vector<int>(k + 1, 0));
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j == 0) {
        dp[i][j] = 1;
        continue;
      }
      for (int jj = 0; jj <= min(vec[i], j); jj++) {
        dp[i][j] = (dp[i][j] % 1000000007 + dp[i - 1][j - jj] % 1000000007) %
                   1000000007;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
