#include <bits/stdc++.h>
using namespace std;
long long int f(long long int i, long long int k, long long int remainder,
                long long int n, long long int a[]) {
  if (i == n && remainder == 0) return 1;
  if (i == n) return 0;
  if (remainder < 0) return 0;
  long long int c = 0;
  for (long long int j = 0; j <= a[i]; j++) {
    c += f(i + 1, k, remainder - j, n, a);
  }
  return c % 1000000007;
}
int32_t main() {
  long long int t, k;
  cin >> t >> k;
  long long int a[t];
  for (long long int i = 0; i < t; i++) cin >> a[i];
  cout << f(0, k, k, t, a);
}
