#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<long long> dp(k + 1), nx;
  dp[0] = 1;
  for (int person = 0; person < n; person++) {
    nx = vector<long long>(k + 2, 0);
    for (int candies = 0; candies <= k; candies++) {
      long long ways = dp[candies] % MOD;
      nx[candies] += ways;
      nx[min(candies + a[person], k) + 1] -= ways;
    }
    for (int i = 0; i <= k; i++)
      dp[i] = (nx[i] + (i > 0 ? dp[i - 1] : 0)) % MOD;
  }
  cout << (dp[k] % MOD) << endl;
}
