#include <bits/stdc++.h>
const int maxk = 1e5 + 5, maxn = 105, mod = 1e9 + 7;
int dp[maxk];
inline int sum(int a, int b) {
  if (a + b >= mod) {
    return a + b - mod;
  } else if (a + b < 0) {
    return a + b + mod;
  }
  return a + b;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int a;
  dp[0] = 1;
  int suma;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    suma = 0;
    for (int j = 0; j <= k; j++) {
      suma = sum(suma, dp[j]);
      if (j - a > 0) {
        suma = sum(suma, -dp[j - a - 1]);
      }
      dp[j] = suma;
    }
  }
  printf("%d\n", dp[k]);
  return 0;
}
