#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100, P = 1e9 + 7;
int f[110][maxn], n, a[maxn], k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    for (int j = 0; j <= k; j++) {
      sum += f[i - 1][j], sum %= P;
      if (j > a[i]) sum -= f[i - 1][j - a[i] - 1];
      f[i][j] = sum;
    }
  }
  printf("%d\n", (f[n][k] % P + P) % P);
  return 0;
}
