#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<long long>;
using vi = vector<int>;
using vvl = vector<vl>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
using ld = long double;
int main() {
  int n, k;
  cin >> n >> k;
  ll mod = 1e9 + 7;
  vi a(n);
  for (auto &e : a) cin >> e;
  vl dp(k + 1), dpt(k + 1, 0);
  for (int i = 0; i <= a[0]; i++) dp[i] = 1;
  for (int i = 1; i < n; i++) {
    ll ways = 0;
    for (int j = 0; j < k + 1; j++) {
      ways = (ways + dp[j]) % mod;
      dpt[j] = ways;
      if (j >= a[i]) ways = (ways - dp[j - a[i]]) % mod;
    }
    dp = vl(dpt.begin(), dpt.end());
  }
  cout << dp[k];
  return 0;
}
