#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int dp[100005];
  int a[103];
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    vector<int> prefix(k + 1, 0);
    vector<int> tmp(k + 2, 0);
    for (int j = k; j >= 0; j--) {
      tmp[j + 1] += dp[j];
      tmp[min(k, j + a[i]) + 1] += -1 * dp[j];
    }
    for (int j = 1; j <= k; j++) {
      prefix[j] = prefix[j - 1] + tmp[j];
      if (prefix[j] >= mod) prefix[j] -= mod;
    }
    for (int j = 0; j <= k; j++) {
      dp[j] += prefix[j];
      if (dp[j] >= mod) dp[j] -= mod;
    }
  }
  if (dp[k] < 0) dp[k] += mod;
  printf("%d\n", dp[k] % mod);
}
