#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int K = 1e5 + 10;
const long long M = 1e9 + 7;
long long DP[N][K];
int T[N];
int n, k;
int min(int x, int y) { return (y < x ? y : x); }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &T[i]);
  }
  DP[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      int c = min(T[i], j);
      if (j - 1 >= 0) DP[i][j] = DP[i][j - 1];
      DP[i][j] = (DP[i][j] + DP[i - 1][j]) % M;
      if (j - c - 1 >= 0) DP[i][j] = (DP[i][j] - DP[i - 1][j - c - 1]) % M;
    }
  }
  printf("%lld", DP[n][k] % M);
  return 0;
}
