#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long N, K;
  cin >> N >> K;
  long long a[N + 5];
  for (long long i = 1; i <= N; i++) cin >> a[i];
  sort(a + 1, a + N + 1);
  long long dp[N + 5][K + 5];
  memset(dp, 0, sizeof(dp));
  long long pre[K + 5];
  memset(pre, 0, sizeof(pre));
  dp[0][0] = 1;
  pre[0] = 1;
  for (long long i = 1; i <= K; i++) {
    pre[i] = pre[i - 1] + dp[0][i];
    if (pre[i] >= mod) pre[i] %= mod;
  }
  for (long long i = 1; i <= N; i++) {
    dp[i][0] = 1;
    for (long long j = 1; j <= K; j++) {
      if (j <= a[i]) {
        dp[i][j] += pre[j];
      } else {
        dp[i][j] += (pre[j - 1] - pre[j - a[i] - 1] + mod);
      }
      if (dp[i][j] >= mod) dp[i][j] %= mod;
    }
    memset(pre, 0, sizeof(pre));
    pre[0] = dp[i][0];
    for (long long j = 1; j <= K; j++) {
      pre[j] = pre[j - 1] + dp[i][j];
      if (pre[j] >= mod) pre[j] %= mod;
    }
  }
  cout << dp[N][K];
}
