#include <bits/stdc++.h>
using namespace std;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const long long MOD = 1e9 + 7;
inline long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
inline long long mod(long long a, long long b) { return ((a % b) + b) % b; }
inline long long expo(long long b, long long p, long long m = MOD) {
  long long ans = 1;
  while (p > 0) {
    if (p & 1LL) ans = mod(ans * b, m);
    b = mod(b * b, m);
    p >>= 1LL;
  }
  return ans;
}
const int N = 105;
const int K = 1e5 + 5;
int dp[N][K], v[N];
int n, k;
int solve(int i, int quant) {
  if (quant < 0) return 0;
  if (i == n) return quant == 0;
  if (dp[i][quant] != -1) return dp[i][quant] % MOD;
  int sum = 0;
  for (int j = 0; j <= v[i]; j++) {
    sum = (sum + solve(i + 1, quant - j)) % MOD;
  }
  return dp[i][quant] = sum;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int> v(n + 1), pref(n + 1, 0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    pref[i] = pref[i - 1] + v[i];
  }
  vector<vector<int>> dp(n + 1, vector<int>(k + 1, 0));
  vector<int> sum(k + 1, 0);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j > pref[i]) break;
      if (!j)
        sum[j] = dp[i - 1][j];
      else
        sum[j] = (dp[i - 1][j] + sum[j - 1]) % MOD;
      dp[i][j] = (dp[i][j] + sum[min(j, v[i - 1])]) % MOD;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
