#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(NULL);
  int n, k, i, j;
  cin >> n >> k;
  int arr[n];
  long int dp[n + 1][k + 1];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    dp[i + 1][0] = 1;
  }
  sort(arr, arr + n);
  for (i = 1; i <= k; i++) {
    if (arr[0] >= i)
      dp[1][i] = 1;
    else
      dp[1][i] = 0;
  }
  for (i = 2; i <= n; i++) {
    for (j = 1; j <= k; j++) {
      if (j <= arr[i - 1])
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % 1000000007;
      else {
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] + dp[i - 1][j - arr[i] - 1] +
                    1000000007) %
                   1000000007;
      }
    }
  }
  cout << dp[n][k];
  return 0;
}
