#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m, mini, maxi, res;
int a[100], dp2[100007], dp1[100007];
int flag = 0;
int get(int k) {
  if (k == 0) return 1;
  if (k < 0) return 0;
  return (flag == 0 ? dp1 : dp2)[k];
}
int main() {
  scanf("%d %d", &n, &maxi);
  mini = maxi;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(dp1, 0, sizeof(dp1));
  res = 0;
  dp1[0] = 1;
  for (i = 1; i <= maxi; i++) dp1[i] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= maxi; j++) {
      k = ((flag == 0 ? dp1 : dp2)[j] - get(j - min(j, a[i]) - 1)) % 1000000007;
      if (k < 0) k += 1000000007;
      (flag == 1 ? dp1 : dp2)[j] =
          (k + (flag == 1 ? dp1 : dp2)[j - 1]) % 1000000007;
    }
    for (j = 0; j <= maxi; j++)
      (flag == 0 ? dp1 : dp2)[j] = (flag == 1 ? dp1 : dp2)[j];
    flag ^= 1;
  }
  k = (flag == 0 ? dp1 : dp2)[maxi] - get(mini - 1);
  if (k < 0) k += 1000000007;
  printf("%d\n", k);
  return 0;
}
