#include <bits/stdc++.h>
using namespace std;
int n, k, mod = 1e9 + 7;
long long memo[100010];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  memo[0] = 1;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    vector<int> diff(100010, 0);
    for (int have = k; have >= 0; have--) {
      int l = have + 1, r = have + min(a, k - have);
      diff[l] += memo[have];
      diff[r + 1] -= memo[have];
    }
    for (int j = 1; j <= k; j++) {
      diff[j] += diff[j - 1];
      memo[j] += diff[j];
      memo[j] %= mod;
    }
  }
  cout << memo[k] << endl;
  return 0;
}
