#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int K = 1e5 + 5;
int dp[110][K];
int a[110];
int n;
int play(int now, int k) {
  if (dp[now][k]) return dp[now][k];
  if (now == n + 1 && k == 0)
    return 1;
  else if (k < 0 || now > n)
    return 0;
  int sum = 0;
  for (int i = 0; i <= a[now]; i++) {
    sum += play(now + 1, k - i);
    sum %= MOD;
  }
  return dp[now][k] = sum;
}
int main() {
  int k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  printf("%d\n", play(1, k));
  return 0;
}
