#include <bits/stdc++.h>
using namespace std;
int in() {
  int n;
  scanf("%d", &n);
  return n;
}
long long Lin() {
  long long n;
  scanf("%lld", &n);
  return n;
}
double Din() {
  double n;
  scanf("%lf", &n);
  return n;
}
const long long inf = (long long)1e17;
const long long mod = (long long)1e9 + 7;
const int N = 1e5 + 5;
long long dp[105][N];
int a[N];
int n, k;
long long call(int pos, int candy) {
  if (candy > k) return 0;
  if (candy == k) return 1;
  if (pos == n + 1) {
    if (candy == k) return 1;
    return 0;
  }
  if (dp[pos][candy] != -1) return dp[pos][candy];
  long long ans = 0;
  for (int i = 0; i <= a[pos]; i++) {
    ans = (ans + call(pos + 1, candy + i)) % mod;
  }
  return dp[pos][candy] = ans;
}
int solve() {
  n = in(), k = in();
  for (int i = 1; i <= n; i++) {
    a[i] = in();
  }
  memset(dp, -1, sizeof dp);
  printf("%lld\n", call(0, 0));
  return 0;
}
int main() {
  int test = 1, tc = 0;
  while (test--) {
    solve();
  }
  return 0;
}
