#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[101];
int dp[100001][101];
bool vis[100001][101];
const int MOD = 1e9 + 7;
int solve(int k, int n) {
  if (n == 0) {
    if (k == 0) return 1;
    return 0;
  }
  if (vis[k][n]) return dp[k][n];
  vis[k][n] = true;
  for (int i = 0; i <= min(k, a[n - 1]); i++)
    dp[k][n] = ((long long)dp[k][n] + solve(k - i, n - 1)) % MOD;
  return dp[k][n];
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << solve(k, n) << endl;
  return 0;
}
