#include <bits/stdc++.h>
using namespace std;
const long long oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
const long long MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> dp(k + 1);
  dp[0] = 1;
  while (n--) {
    vector<long long> ndp(k + 1);
    long long a;
    cin >> a;
    long long sum = 0;
    for (long long i = (0); i < (k + 1); i++) {
      sum += dp[i];
      if (i > a) sum -= dp[i - a - 1];
      sum %= MOD;
      ndp[i] = sum;
    }
    dp = ndp;
  }
  cout << dp[k] << endl;
}
