#include <bits/stdc++.h>
using namespace std;
long long mod = pow(10, 9) + 7;
long long dp[105][100005];
long long n, k;
long long arr[105];
long long calc(long long idx, long long candy) {
  if (idx == n && candy == k) {
    return 1;
  }
  if (idx == n) {
    return 0;
  }
  if (candy > k) {
    return 0;
  }
  if (dp[idx][candy] != -1) {
    return dp[idx][candy];
  }
  long long total = arr[idx];
  long long ans1 = calc(idx + 1, candy);
  for (long long i = 1; i <= total; ++i) {
    long long ans2 = 0;
    if (candy + i <= k) {
      ans2 = calc(idx + 1, candy + i);
    }
    ans2 %= mod;
    ans1 = ((ans1 % mod) + (ans2 % mod)) % mod;
  }
  dp[idx][candy] = ans1 % mod;
  return dp[idx][candy];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (long long i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  cout << calc(0, 0) << endl;
}
