#include <bits/stdc++.h>
using namespace std;
void enter(vector<long long int> &ar) {
  long long int n = ar.size();
  for (long long int i = 0; i < n; i++) {
    cin >> ar[i];
  }
}
void show(vector<long long int> &a) {
  long long int n = a.size();
  for (long long int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
}
void SieveOfErat1sthenes(int n, vector<long long int> &pri) {
  vector<bool> prime(n + 1, true);
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      pri.push_back(p);
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
long long int mo(long long int a) { return a % (long long int)(1e9 + 7); }
bool compare(pair<long long int, long long int> a,
             pair<long long int, long long int> b) {
  return a.first > b.first;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  vector<long long int> a(n);
  enter(a);
  vector<vector<long long int>> dp(k + 1, vector<long long int>(n + 1)),
      mat(k + 1, vector<long long int>(n + 1));
  vector<long long int> sum(n + 1, 0);
  sort(a.begin(), a.end(), greater<long long int>());
  for (long long int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i - 1];
  }
  for (long long int i = 0; i <= n; i++) dp[0][i] = 1;
  for (long long int i = 0; i <= n; i++) mat[0][i] = 1;
  for (long long int i = 0; i <= k; i++) mat[i][0] = 1;
  for (long long int i = 1; i <= k; i++) {
    for (long long int j = 1; j <= n; j++) {
      if (sum[j] >= i) {
        dp[i][j] = mo(
            mo(mat[i][j - 1]) -
            mo(((i - a[j - 1] - 1 >= 0) ? mat[i - a[j - 1] - 1][j - 1] : 0)));
      }
      mat[i][j] = mo(mo(dp[i][j]) + mo(mat[i - 1][j]));
    }
  }
  if (sum[n] < k) dp[k][n] = 0;
  cout << dp[k][n] << "\n";
  return 0;
}
