#include <bits/stdc++.h>
using namespace std;
int n, m, a[105], i, j, k, mod, r[105][105];
int s(int i, int j) {
  if (j > m) return 0;
  if (j == m) return 1;
  if (i == n + 1) return 0;
  if (r[i][j] > 0) return r[i][j];
  int l = 0;
  for (int k = 0; k <= a[i]; k++) l = (l + s(i + 1, j + k)) % mod;
  r[i][j] = l;
  return l;
}
int main() {
  mod = 1e9 + 7;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  printf("%d\n", s(1, 0));
}
