#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
long long n, k, m = 1000000007;
long long a[105];
long long solve(long long i, long long left) {
  if (dp[i][left] != -1) return dp[i][left];
  if (i == n) {
    if (left == 0)
      return dp[i][left] = 1;
    else {
      return dp[i][left] = 0;
    }
  } else {
    dp[i][left] = 0;
    for (long long t = 0; t <= a[i]; t++) {
      if (left >= t) dp[i][left] = (dp[i][left] + solve(i + 1, left - t)) % m;
    }
    return dp[i][left];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < 105; i++)
    for (int j = 0; j < 100005; j++) dp[i][j] = -1;
  long long ans = solve(0, k);
  cout << ans;
  return 0;
}
