#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long gcd(long long a, long long b) {
  while (b > 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
const long long INF = 4e18 + 10;
const long long INF2 = 2e18 + 10;
const long long INF3 = 2e10;
const long long MAXN = 303;
const long long LOGN = 19;
const long long MOD = 1e9 + 7;
const long long EPS = 1e-9;
const long long MULT = 2e5;
const long long MCNST = MOD * MOD * 8;
long long dp[101][100005];
long long p[200005];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] = 0;
    }
  }
  for (long long i = 0; i <= 2 * k; i++) p[i] = 0;
  dp[0][0] = 1;
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    for (long long j = 0; j <= k; j++) {
      p[j] += dp[i][j];
      p[j + a + 1] -= dp[i][j];
    }
    long long cv = 0;
    for (long long j = 0; j <= k; j++) {
      cv += p[j];
      p[j] = 0;
      cv %= MOD;
      if (cv < 0) cv = -cv;
      dp[i + 1][j] = cv;
    }
  }
  cout << dp[n][k];
}
