#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MAX_SZ = 2e5 + 9;
const long long INF = 1e18 + 9;
long long N, k;
long long dp[101][100005], arr[102];
void rand_shuff(vector<long long> &arr) {
  random_device rd;
  mt19937 g(rd());
  shuffle(arr.begin(), arr.end(), g);
}
long long solve(long long n, long long req) {
  if (n < 1) return 0;
  if (dp[n][req] != -1) return dp[n][req];
  if (req < 0) return 0;
  if (n == 1 && req <= arr[1]) return dp[n][req] = 1;
  if (n == 1) return 0;
  long long res = 0;
  for (long long i = (0); i < (arr[n] + 1); i++) {
    res += (solve(n - 1, req - i));
    res %= MOD;
  }
  return dp[n][req] = res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> N >> k;
  long long res = 0;
  memset(dp, -1, sizeof(dp));
  for (long long i = (1); i < (N + 1); i++) cin >> arr[i];
  cout << solve(N, k) << "\n";
  return 0;
}
