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