#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;
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] = 0;
    }
  }
  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 sum = 0;
    for (long long j = 0; j <= arr[i]; j++) {
      sum = (dp[i - 1][j] + sum) % 1000000007;
      dp[i][j] = sum;
    }
    for (long long j = arr[i] + 1; j <= k; j++) {
      sum = (sum - dp[i - 1][j - arr[i] - 1]) % 1000000007;
      sum = (dp[i][j] + sum) % 1000000007;
      dp[i][j] = sum;
    }
  }
  cout << dp[n - 1][k];
  return 0;
}
