#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<long long> a;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  vector<long long> dp(k + 1, 0);
  vector<long long> p(k + 1, 1);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      if (j == 0) {
        p[j] = dp[j];
        continue;
      }
      p[j] = (dp[j] + p[j - 1]) % (long long)(1e9 + 7);
      if (j - (a[i] + 1) >= 0)
        dp[j] = max(p[j] - p[j - a[i] - 1], (long long)0);
      else
        dp[j] = p[j];
    }
  }
  cout << dp[k];
}
