#include <bits/stdc++.h>
using namespace std;
long rec(int a[], int n, long **mem, int id, int k) {
  if (id == n && k > 0) return -1;
  if (id == n && k == 0) return 1;
  if (mem[id][k] != -1) return mem[id][k];
  long ans = 0;
  for (int i = 0; i <= min(k, a[id]); i++) {
    long ans1 = rec(a, n, mem, id + 1, k - i);
    if (ans1 == -1) continue;
    ans1 %= 1000000007;
    ans = (ans % 1000000007 + ans1 % 1000000007) % 1000000007;
  }
  mem[id][k] = ans;
  return ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long **mem = new long *[n + 1];
  for (int i = 0; i <= n; i++) {
    mem[i] = new long[k + 1];
    for (int j = 0; j <= k; j++) mem[i][j] = -1;
  }
  cout << rec(a, n, mem, 0, k);
}
