#include <bits/stdc++.h>
using namespace std;
int n, k;
int func(int curr_sum, int *a, int index) {
  if (curr_sum == k and index == n) return 1;
  if (curr_sum > k or index >= n) return 0;
  int ans = 0;
  for (int i = 0; i <= a[index]; i++) {
    ans += func(curr_sum + i, a, index + 1);
  }
  return ans % 1000000007;
}
int main() {
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << func(0, a, 0);
  return 0;
}
