#include <bits/stdc++.h>
using namespace std;
long long int arr[105], dp[105][100005];
long long int n;
long long int rec(long long int l, long long int sum) {
  if (dp[l][sum] != -1) return dp[l][sum];
  if (sum < 0) return 0;
  if (sum == 0) return 1;
  if (l == n) {
    if (sum <= arr[l]) {
      return 1;
    } else
      return 0;
  }
  long long int sum1 = 0;
  for (long long int i = 0; i <= arr[l]; i++) {
    sum1 += (rec(l + 1, sum - i)) % 1000000007;
  }
  dp[l][sum] = sum1 % 1000000007;
  return sum1 % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int k;
  cin >> n >> k;
  for (long long int i = 1; i <= n; i++) cin >> arr[i];
  for (long long int i = 0; i <= k; i++) dp[k][0] = 1;
  for (long long int i = 1; i <= k; i++) {
    if (k <= arr[n])
      dp[n][k] = 1;
    else
      dp[n][k] = 0;
  }
  memset(dp, -1, sizeof(dp));
  cout << rec(1, k);
}
