#include <bits/stdc++.h>
const int N = 1e5 + 100;
const int M = 1e6 + 100;
const long long oo = 1e18;
long long n, m, k, t, q, h, a, b, d, c, e, w, x, y, z;
using namespace std;
long long ar[102], dp[101][100005], MOD = 1e9 + 7;
long long calc(int ind, int left) {
  if (ind == n) {
    if (!left) return 1;
    return 0;
  }
  long long &ret = dp[ind][left];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 0; i <= ar[ind]; i++) {
    if (left < i) continue;
    ret = (ret + (calc(ind + 1, left - i) % MOD)) % MOD;
    ;
  }
  return ret;
}
int main() {
  scanf("%lld %lld", &n, &k);
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < n; i++) {
    scanf("%lld", ar + i);
  }
  printf("%lld", calc(0, k));
  return 0;
}
