#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  long long int m = pow(10, 9) + 7;
  int a[n + 1];
  long long int dp[n + 1][k + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= k; i++) {
    if (a[1] >= i)
      dp[1][i] = (1 + dp[1][i - 1] % m) % m;
    else
      dp[1][i] = dp[1][i - 1] % m;
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (j - a[i] <= 0)
        dp[i][j] = (dp[i - 1][j]) % m;
      else
        dp[i][j] = (dp[i - 1][j] % m - dp[i - 1][j - a[i] - 1] % m) % m;
      dp[i][j] = (dp[i][j] % m + dp[i][j - 1] % m) % m;
    }
  }
  if (k == 0) {
    cout << 1 << endl;
    return 0;
  }
  cout << (dp[n][k] % m - dp[n][k - 1] % m) % m << endl;
}
