#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T;
  T = 1;
start:
  while (T--) {
    long long n, m;
    cin >> n >> m;
    long long a[n];
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    long long dp[n][m + 1];
    for (long long i = 0; i < n; i++) {
      dp[i][0] = 1;
    }
    for (long long i = 0; i <= m; i++) {
      if (i <= a[0]) {
        dp[0][i] = 1;
      } else {
        dp[0][i] = 0;
      }
    }
    for (long long i = 1; i < n; i++) {
      long long sum = 0;
      for (long long j = 0; j <= m; j++) {
        if (j <= a[i]) {
          sum += dp[i - 1][j];
          sum = sum % mod;
          dp[i][j] = sum;
        } else {
          sum = (sum + dp[i - 1][j]) % mod - dp[i - 1][j - a[i] - 1];
          sum = sum % mod;
          dp[i][j] = sum;
        }
      }
    }
    cout << dp[n - 1][m] << endl;
  }
  return 0;
}
