#include <bits/stdc++.h>
using namespace std;
long long n, K;
long long dp[101][100005];
long long md = 1000000007;
long long a[105];
long long ways(long long i, long long k) {
  if (i == n) {
    if (k == 0) return 1;
    return 0;
  }
  if (dp[i][k] != -1) return dp[i][k];
  long long cur_ways = 0;
  for (long long j = 0; j <= min(k, a[i]); j++)
    cur_ways = (cur_ways + ways(i + 1, k - j)) % md;
  return dp[i][k] = cur_ways;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> K;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j <= K; j++) dp[i][j] = -1;
  cout << ways(0, K);
  return 0;
}
