#include <bits/stdc++.h>
using namespace std;
vector<long long> v(103);
long long dp[103][100003];
long long solve(long long n, long long sum) {
  if (sum == 0) return 1;
  if (n == 0 || sum < 0) return 0;
  if (dp[n][sum] != -1) return dp[n][sum];
  long long ans = 0;
  for (auto i = 0; i < v[n - 1] + 1; i += 1) {
    if (i <= sum) {
      ans = (ans + solve(n - 1, sum - i)) % 1000000007;
    }
  }
  return dp[n][sum] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, -1, sizeof(dp));
  long long n, k, sum = 0;
  cin >> n >> k;
  for (auto i = 0; i < n; i += 1) cin >> v[i], sum += v[i];
  if (sum < k)
    cout << "0";
  else {
    cout << solve(n, k);
  }
  return 0;
}
