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