#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e13;
const long long int N = 301;
const long long int mod = 1000000007;
bool prime(long long int x) {
  if (x < 2) return false;
  for (long long int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
vector<long long int> fac(N);
void fact() {
  fac[0] = 1;
  for (long long int i = 1; i < N; i++) fac[i] = (fac[i - 1] * i) % mod;
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  vector<vector<long long int> > dp(n + 1, vector<long long int>(k + 1, 0));
  dp[0][0] = 1;
  for (long long int i = 1; i < n + 1; i++) {
    long long int temp = 0;
    for (long long int j = 0; j < k + 1; j++) {
      temp += dp[i - 1][j];
      if (a[i - 1] <= j) temp -= dp[i - 1][j - a[i - 1]];
      temp %= mod;
      dp[i][j] = temp;
    }
  }
  cout << (dp[n][k] + mod) % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) solve();
  return 0;
}
