#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  vector<int> v(n);
  for (auto &e : v) {
    cin >> e;
  }
  vector<vector<int> > dp(n + 1, vector<int>(k + 1));
  for (int i = 1; i <= k; i++) {
    dp[0][i] = 0;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int g = 0; g <= v[i - 1]; g++) {
        if (g <= j)
          dp[i][j] = (0LL + dp[i][j] + dp[i - 1][j - g]) % (1000000000 + 7);
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
