#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
void ad(long long &a, long long b) {
  a += b;
  if (a > mod) a -= mod;
}
void su(long long &a, long long b) {
  a -= b;
  if (a < 0) a += mod;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> dp(k + 1);
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0] = 1;
  for (long long i = 0; i < n; i++) {
    for (long long used = k; used >= 0; used--) {
      for (long long now = 1; now <= min(k - used, a[i]); now++) {
        ad(dp[used + now], dp[used]);
      }
    }
  }
  cout << dp[k];
  return 14 / 88;
}
