#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> dp(110, vector<long long>(100010, -1));
vector<long long> x;
long long n, k, a;
long long ans(long long curr, long long val) {
  if (curr == n) {
    if (val == 0) {
      return 1;
    }
    return 0;
  }
  if (dp[curr][val] != -1) {
    return dp[curr][val];
  }
  int ret = 0;
  for (int i = 0; i <= min(x[curr], val); i += 1) {
    ret += ans(curr + 1, val - i);
  }
  dp[curr][val] = ret;
  return ret;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i += 1) {
    cin >> a;
    x.push_back(a);
  }
  cout << ans(0, k) % 1000000007;
}
