#include <bits/stdc++.h>
long int N, K, A[101][100001], a[101];
long int dp(long int n, long int m) {
  long int temp;
  long int k, s;
  if (A[n][m] != -1) {
    return A[n][m];
  } else {
    temp = 0;
    for (s = 0; s <= a[n] && m - s >= 0; s++) {
      temp += dp(n - 1, m - s);
      temp = temp % 1000000007;
    }
  }
  A[n][m] = temp % 1000000007;
  return temp;
}
int main() {
  long int i, j, x;
  scanf("%ld %ld", &N, &K);
  for (i = 1; i < N + 1; i++) {
    scanf("%ld", &a[i]);
  }
  for (i = 0; i < N + 1; i++) {
    for (j = 0; j < K + 1; j++) {
      A[i][j] = -1;
    }
  }
  for (j = 0; j < K + 1; j++) {
    if (j <= a[1]) {
      A[1][j] = 1;
    } else {
      A[1][j] = 0;
    }
  }
  printf("%ld", dp(N, K));
  return 0;
}
