#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  vector<vector<long long>> dp(n, vector<long long>(k + 1));
  int MOD = 1e9 + 7;
  for (int j = 0; j <= min(k, A[0]); j++) {
    dp[0][j] = 1;
  }
  for (int i = 1; i < n; i++) {
    long long temp = 0;
    for (int j = 0; j <= A[i]; j++) {
      temp += (dp[i - 1][j]);
      temp %= MOD;
      dp[i][j] = temp;
    }
    for (int j = A[i] + 1; j <= k; j++) {
      temp -= dp[i][j - A[i] - 1];
      temp %= MOD;
      dp[i][j] = temp;
    }
  }
  cout << dp[n - 1][k] << endl;
}
