#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long p) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans *= a;
    p /= 2;
    a *= a;
    ans %= mod;
    a %= mod;
  }
  return ans;
}
long long mdinv(long long a) { return powmod(a, mod - 2); }
long long func(int i, int x, vector<vector<long long> > &dp, vector<int> &v) {
  if (i == v.size()) {
    if (x == 0) return 1;
    return 0;
  }
  if (dp[i][x] != -1) return dp[i][x];
  dp[i][x] = 0;
  for (int j = 0; j <= min(x, v[i]); j++) {
    dp[i][x] += func(i + 1, x - j, dp, v);
    dp[i][x] %= mod;
  }
  return dp[i][x];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<vector<long long> > dp(n, vector<long long>(k + 1, -1));
  func(0, k, dp, v);
  cout << dp[0][k] << endl;
  return 0;
}
