#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const int N = 111;
const int K = 1e5 + 7;
long long int dp[2][K];
long long int qry(int i, int j, int k) {
  long long int l = 0, r = dp[i][k];
  if (j > 0) l = dp[i][j - 1];
  return (r + mod - l) % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  int cur = 0;
  for (int i = 0; i <= k; ++i) dp[cur][i] = 1;
  for (int i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    cur ^= 1;
    for (int j = k; j >= 0; --j) dp[cur][j] = qry(cur ^ 1, j - a, j);
    for (int j = 1; j <= k; ++j)
      dp[cur][j] = (dp[cur][j - 1] + dp[cur][j]) % mod;
  }
  if (k > 0)
    cout << dp[cur][k] - dp[cur][k - 1] << endl;
  else
    cout << dp[cur][k] << endl;
  return 0;
}
