#include <bits/stdc++.h>
using namespace std;
long long parent[2000005];
long long ans = 0;
vector<vector<long long> > dp(100001, vector<long long>(101, -1));
long long helper(vector<long long> &arr, long long k, long long i) {
  if (i == arr.size()) {
    if (k == 0) return 1;
    return 0;
  }
  if (dp[k][i] != -1) return dp[k][i];
  long long sum = 0;
  for (int j = 0; j <= arr[i]; j++) {
    if (k - j >= 0) {
      sum += helper(arr, k - j, i + 1);
      sum %= 1000000007;
    }
  }
  return dp[k][i] = sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  cout << helper(arr, k, 0) % 1000000007;
  return 0;
}
