#include <bits/stdc++.h>
using namespace std;
long long int dp[105][100005];
int ara[105];
int main() {
  long long int i, j, n, k, ans, sum = 0;
  scanf("%lld %lld", &(n), &(k));
  for (i = 1; i <= n; i++) {
    scanf("%d", &(ara[i]));
    sum += ara[i];
  }
  for (i = 0; i <= ara[1]; i++) dp[1][i] = 1;
  for (i = 1; i <= k; i++) dp[1][i] = (dp[1][i] + dp[1][i - 1]) % 1000000007;
  for (i = 2; i <= n; i++) {
    for (j = 0; j <= ara[i]; j++) {
      dp[i][j] = dp[i - 1][j];
    }
    for (j = 0; j <= k && i < n; j++) {
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % 1000000007;
    }
  }
  if (sum < k)
    printf("0\n");
  else
    cout << dp[n][ara[n]] << endl;
  return 0;
}
