#include <bits/stdc++.h>
#pragma GCC optimize("O3")
std::pair<int, int> DR[] = {{-1, 0}, {0, 1},   {1, 0}, {0, -1},
                            {-1, 1}, {-1, -1}, {1, 1}, {1, -1}};
using namespace std;
long long n, k, dp[1 << 17], x;
const long long mod = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n >> k;
  dp[0] = 1;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    for (long long val = k; val >= 0; val--) {
      dp[val] = dp[val] - (val - x - 1 >= 0 ? dp[val - x - 1] : 0);
      dp[val] %= mod;
    }
    for (long long val = 1; val <= k; val++) {
      dp[val] += dp[val - 1];
      dp[val] %= mod;
    }
  }
  return cout << dp[k], 0;
}
