#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long n, k, a[100005];
long long dp[105][100005];
long long pre[100005];
long long sum(int l, int r) {
  if (l <= 0)
    return pre[r];
  else
    return pre[r] - pre[l - 1];
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i <= k; i++) {
    if (i) pre[i] = pre[i - 1];
    pre[i] += dp[0][i];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      int o = a[i];
      dp[i][j] += sum(j - a[i], j);
      dp[i][j] %= mod;
    }
    for (int j = 0; j <= k; j++) {
      if (i) pre[j] = pre[j - 1];
      pre[j] += dp[i][j];
      pre[j] %= mod;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
