#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 10;
const int MOD = 1e9 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> f(k + 1, 1);
  while (n--) {
    int use;
    cin >> use;
    for (int i = k; i >= 0; i--) {
      f[i] -= (i - use - 1 >= 0 ? f[i - use - 1] : 0);
    }
    for (int i = 1; i <= k; i++) f[i] = (f[i] + f[i - 1]) % MOD;
  }
  cout << (f[k] - f[k - 1] + 2LL * MOD) % MOD;
}
