#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    int n, k;
    cin >> n >> k;
    if (k == 0) {
      cout << 1 << endl;
      return 0;
    }
    vector<long long int> a(n + 1);
    vector<vector<long long int> > dp(k + 1, vector<long long int>(n + 1, 1));
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
    }
    sort(a.begin(), a.end());
    long long int ans = 0;
    for (int i = 1; i <= k; ++i) {
      long long int sum = 0;
      for (int j = 1; j <= n; j++) {
        sum += a[j];
        if (sum < i) {
          dp[i][j] = dp[i - 1][j];
        } else {
          long long int res = 0;
          if (a[j] >= i) {
            res = dp[i][j - 1];
          } else {
            res = dp[i][j - 1] - dp[i - a[j] - 1][j - 1];
          }
          dp[i][j] = (dp[i - 1][j] + res) % 1000000007;
          ans = res;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
