#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> vect(n + 1);
  vector<int> capacity(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> vect[i];
    capacity[i] += capacity[i - 1] + vect[i];
  }
  vector<vector<long long int>> dp(n + 1, vector<long long int>(k + 1));
  for (int i = 0; i <= k; i++) dp[0][i] = 0;
  for (int i = 1; i <= n; i++) dp[i][0] = 1;
  for (int i = 0; i <= k; i++) {
    if (i <= vect[1])
      dp[1][i] = 1;
    else
      dp[1][i] = 0;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j > capacity[i])
        dp[i][j] = 0;
      else {
        for (int m = 0; m <= vect[i] && m <= j; m++) {
          dp[i][j] += dp[i - 1][j - m];
          dp[i][j] %= 1000000007;
        }
      }
    }
  }
  cout << dp[n][k] % 1000000007;
  return 0;
}
