#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
const int K = 100 * 1000 + 5;
const int MOD = 1000 * 1000 * 1000 + 7;
int n, k;
vector<int> a;
int dp[N][K];
int ps[K];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int e;
    cin >> e;
    a.push_back(e);
  }
  for (int j = 0; j <= a[0]; j++) {
    dp[0][j] = 1;
  }
  for (int j = 0; j < K; j++) {
    ps[j] = (j - 1 >= 0 ? ps[j - 1] : 0) + dp[0][j];
  }
  for (int lastChild = 1; lastChild < n; lastChild++) {
    for (int candies = 0; candies <= k; candies++) {
      for (int lastCandies = 0; lastCandies <= a[lastChild]; lastCandies++) {
        if (candies - lastCandies >= 0) {
          dp[lastChild][candies] += dp[lastChild - 1][candies - lastCandies];
          dp[lastChild][candies] %= MOD;
        }
      }
    }
    for (int j = 0; j < K; j++) {
      ps[j] = (j - 1 >= 0 ? ps[j - 1] : 0) + dp[lastChild][j];
    }
  }
  int res = dp[n - 1][k];
  cout << res << endl;
  return 0;
}
