#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n + 1], dp[n + 1][k + 1], dp_pre[n + 1][k + 2], pre[n + 1];
  memset(dp, 0, sizeof dp);
  memset(dp_pre, 0, sizeof dp_pre);
  pre[0] = 0;
  for (int i = 0; i < (n); ++i) cin >> a[i + 1];
  sort(a + 1, a + n + 1);
  for (int i = 0; i < (n); ++i) pre[i + 1] = pre[i] + a[i + 1];
  for (int i = 0; i < (n + 1); ++i) dp[i][0] = 1, dp_pre[i][1] = 1;
  for (int i = 0; i < (min(pre[1], k) + 1); ++i) dp[1][i] = 1;
  for (int i = 1; i < (k + 1); ++i)
    dp_pre[1][i + 1] = (dp_pre[1][i] + dp[1][i]) % mod;
  for (int i = 2; i < (n + 1); ++i) {
    for (int j = 1; j < (min(pre[i], k) + 1); ++j) {
      long long dj = min((long long)j, pre[i - 1]);
      dp[i][j] =
          ((dp_pre[i - 1][j + 1] - dp_pre[i - 1][max(0LL, j - a[i])]) % mod +
           mod) %
          mod;
      dp_pre[i][j + 1] = (dp_pre[i][j] + dp[i][j]) % mod;
    }
  }
  cout << dp[n][k] << '\n';
}
