#include <bits/stdc++.h>
using namespace std;
int DEBUGGING = 0;
const int INF = 1000000000;
const int MOD = 1000000007;
const long long LINF = 1e18;
const double PI = 3.1415926535897932;
const double EPS = 1e-7;
long long gcdEx(long long a, long long b, long long *x, long long *y) {
  if (!a) {
    *x = 0;
    *y = 1;
    return b;
  }
  long long x1, y1, gcd = gcdEx(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long modI(long long b, long long m) {
  long long x, y;
  gcdEx(b, m, &x, &y);
  return (x % m + m) % m;
}
long long modD(long long a, long long b) {
  return (modI(b, MOD) * (a % MOD)) % MOD;
}
long long modS(long long a, long long b) {
  return ((a % MOD) - (b % MOD) + MOD) % MOD;
}
long long modP(long long x, long long y) {
  long long r = 1;
  x %= MOD;
  while (y > 0) {
    if (y & 1) {
      r = (r * x) % MOD;
    }
    y = y >> 1;
    x = (x * x) % MOD;
  }
  return r;
}
long long modA(long long a, long long b) {
  return ((a % MOD) + (b % MOD)) % MOD;
}
long long modM(long long a, long long b) {
  return ((a % MOD) * (b % MOD)) % MOD;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dp[105][100005];
int in[100005];
int a[105];
void solve(int TEST_CASE) {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (n); ++i) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  int cc;
  for (int i = 0; i < (a[0] + 1); ++i) dp[1][i] = 1;
  for (int i = 2; i <= (n); ++i) {
    memset(in, 0, sizeof(in));
    for (int j = 0; j < (k + 1); ++j) {
      in[j] = (in[j] + dp[i - 1][j]) % MOD;
      if (j + a[i - 1] < 100003)
        in[j + a[i - 1] + 1] = (in[j + a[i - 1] + 1] - dp[i - 1][j]) % MOD;
    }
    if (DEBUGGING) {
      cout << "in " << i << ": ";
      for (int j = 0; j < (k + 2); ++j) cout << in[j] << ",";
      cout << "\n";
    }
    cc = 0;
    for (int j = 0; j < (k + 3); ++j) {
      cc = (cc + in[j]) % MOD;
      dp[i][j] = cc;
    }
  }
  if (DEBUGGING) {
    for (int i = 0; i < (n + 1); ++i) {
      for (int j = 0; j < (k + 1); ++j) {
        cout << dp[i][j] << ",";
      }
      cout << "\n";
    }
  }
  cout << dp[n][k];
}
int main(int argc, char *argv[]) {
  if (argc == 2 && argv[1][1] == 'v') DEBUGGING = 1;
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.exceptions(cin.failbit);
  int nTestCases = 1;
  for (int i = 1; i <= (nTestCases); ++i) solve(i);
  return 0;
}
