#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
const int MOD = 1e9 + 7;
int a[maxn];
long long sum[200][maxn];
long long dp[200][maxn];
int main() {
  int n = 0, k = 0;
  while (~scanf("%d %d", &n, &k)) {
    long long tot = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", a + i);
      tot += 1ll * a[i];
    }
    if (tot < k) {
      puts("0");
      continue;
    }
    for (int i = 1; i <= n; i++) {
      dp[i][0] = 1;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= a[i]; j++) {
        dp[i][j] = sum[i - 1][j];
        if (j == 0)
          sum[i][j] = dp[i][j];
        else
          sum[i][j] = (sum[i][j - 1] + dp[i][j]) % MOD;
      }
      for (int j = a[i] + 1; j <= k; j++) {
        dp[i][j] = dp[i][j - 1] % MOD;
        sum[i][j] = sum[i][j - 1] % MOD;
      }
    }
    printf("%d\n", dp[n][k] % MOD);
  }
  return 0;
}
