#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
const double PI = acos(-1.);
const int N = 1e2 + 2;
const int K = 1e5 + 5;
const int Ai = 1e6 + 6;
const int LOGN = 30;
long long dp[N][K];
long long pre[N][K];
int a[N];
int n, k;
long long sigma(int x, int l, int r) {
  if (!l) return pre[x][r];
  return pre[x][r] - pre[x][l - 1];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[n][0] = 1;
  pre[n][0] = dp[n][0];
  for (int j = 1; j <= k; j++)
    (pre[n][j] = pre[n][j - 1] + dp[n][j]) %= 1000000007;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j <= k; j++)
      (dp[i][j] = sigma(i + 1, max(0, j - a[i]), j)) %= 1000000007;
    pre[i][0] = dp[i][0];
    for (int j = 1; j <= k; j++)
      (pre[i][j] = pre[i][j - 1] + dp[i][j]) %= 1000000007;
  }
  cout << dp[0][k] << "\n";
  return 0;
}
