#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007LL;
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  long long dp[n + 1][k + 1];
  fill(dp[0], dp[n] + k + 1, 0LL);
  dp[0][0] = 1LL;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = 1LL;
    for (int j = 1; j <= k; j++) {
      if (j <= a[i - 1]) {
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod;
      } else {
        dp[i][j] =
            (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - a[i - 1] - 1]) % mod;
      }
    }
  }
  cout << dp[n][k] << "\n";
  return 0;
}
