#include <bits/stdc++.h>
using namespace std;
const unsigned long long MOD = 1e9 + 7;
int dp[2][100005];
int sum[100005];
int a[100005];
int add(int l, int r) { return sum[r] - ((l > 0) ? sum[l - 1] : 0); }
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[1][0] = 1;
  int ii = 0;
  for (int i = 0; i < n; i++, ii ^= 1) {
    sum[0] = dp[ii ^ 1][0];
    for (int j = 1; j <= k; j++) {
      sum[j] = sum[j - 1] + dp[ii ^ 1][j];
      if (sum[j] >= MOD) sum[j] -= MOD;
    }
    for (int j = 0; j <= k; j++) {
      dp[ii][j] = add(j - a[i], j);
      if (dp[ii][j] >= MOD) dp[ii][j] -= MOD;
    }
  }
  cout << dp[ii ^ 1][k];
}
