#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long A[n + 1];
  for (int i = 1; i <= n; i++) cin >> A[i];
  if (k == 0) {
    cout << "1";
    return 0;
  }
  A[0] = 0;
  sort(A + 1, A + n + 1);
  long long ans[k + 1][n + 1];
  ans[0][0] = 1;
  for (int i = 1; i <= k; i++) {
    ans[i][0] = 1;
  }
  for (int i = 1; i <= n; i++) ans[0][i] = 1;
  long long mod = 1e9 + 7;
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= A[j]; i++) {
      ans[i][j] = (ans[i][j - 1] + ans[i - 1][j]) % mod;
    }
    for (int i = A[j] + 1; i <= k; i++)
      ans[i][j] =
          (ans[i][j - 1] - ans[i - A[j] - 1][j - 1] + ans[i - 1][j]) % mod;
  }
  cout << (ans[k][n] - ans[k - 1][n]) % mod;
  return 0;
}
