#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  scanf("%lld%lld", &n, &k);
  vector<long long> a(n + 1);
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, 0));
  for (long long i = 1; i <= n; ++i) scanf("%lld", a.begin() + i);
  dp.at(0).at(0) = 1;
  for (long long i = 1; i <= n; ++i)
    for (long long j = 0; j <= k; ++j)
      dp.at(i).at(j) = accumulate(dp.at(i - 1).begin() + max(0LL, j - a.at(i)),
                                  dp.at(i - 1).begin() + min(k, j) + 1, 0LL) %
                       1000000007;
  printf("%lld\n", dp.back().back());
  return 0;
}
