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