#include <bits/stdc++.h>
using namespace std;
long long int n, k;
vector<long long int> a;
long long int memo[102][100004];
long long int recur(long long int k, long long int c) {
  if (c == n && k == 0)
    return 1;
  else if (c == n)
    return 0;
  if (k < 0) return 0;
  long long int ans = 0;
  for (long long int i = 0; i <= a[c]; i++) {
    if (memo[c + 1][k - i] == -1)
      ans = (ans + recur(k - i, c + 1)) % 1000000007;
    else
      ans = (ans + memo[c + 1][k - i]) % 1000000007;
  }
  memo[c][k] = ans;
  return ans;
}
int32_t main(void) {
  long long int t = 1;
  while (t--) {
    cin >> n >> k;
    for (long long int i = 0; i < n; i++) {
      long long int temp;
      cin >> temp;
      a.push_back(temp);
    }
    for (long long int i = 0; i <= n; i++)
      for (long long int j = 0; j <= k; j++) memo[i][j] = -1;
    cout << recur(k, 0) << endl;
  }
}
