#include <bits/stdc++.h>
using namespace std;
long long int dp[200][100006];
long long int candy(long long int n, long long int k, long long int *arr) {
  if (n == 1 and arr[n] > k) return 0;
  if (n == 1 and arr[n] < k) return 1;
  if (k < 0) return 0;
  if (dp[n][k] != -1) return dp[n][k];
  if ((k - 1 - arr[n]) >= 0) {
    return dp[n][k] = (candy(n, k - 1, arr) + candy(n - 1, k, arr) -
                       (candy(n - 1, k - 1 - arr[n], arr))) %
                      1000000007;
  } else
    return dp[n][k] =
               (candy(n, k - 1, arr) + candy(n - 1, k, arr)) % 1000000007;
}
signed main() {
  long long int n;
  cin >> n;
  long long int k;
  cin >> k;
  memset(dp, -1, sizeof dp);
  long long int arr[n];
  for (long long int i = 1; i < n + 1; ++i) cin >> arr[i];
  cout << candy(n, k, arr);
}
