#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
const long long INF = 1e15;
const int MOD = 1e9 + 7;
int n, k;
int dp[M][105], cant[105];
int DP(int a, int b) {
  if (a > k) return 0;
  if (b == n) {
    if (cant[b] + a >= k)
      return 1;
    else
      return 0;
  }
  if (dp[a][b] != -1) return dp[a][b];
  dp[a][b] = 0;
  for (int i = 0; i < cant[b] + 1; i++)
    dp[a][b] = (DP(a + i, b + 1) + dp[a][b]) % MOD;
  return dp[a][b];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i < n + 1; i++) cin >> cant[i];
  memset(dp, -1, sizeof dp);
  cout << DP(0, 1) << "\n";
  return 0;
}
