#include <bits/stdc++.h>
using namespace std;
long long int DP[200000][400];
int n, k;
int arr[400];
long long int compute(int left, int pos) {
  if (pos == 0 && left > 0) return 0;
  if (DP[left][pos] != -1) return DP[left][pos];
  DP[left][pos] = 0;
  for (int i = 0; i <= arr[pos - 1]; i++) {
    if (left - i >= 0) DP[left][pos] += compute(left - i, pos - 1);
  }
  DP[left][pos] %= 1000000007;
  return DP[left][pos];
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i <= k; i++) {
    for (int j = 0; j <= n; j++) DP[i][j] = -1;
  }
  DP[0][0] = 1;
  long long int ans = compute(k, n);
  cout << ans << endl;
  return 0;
}
