#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15 + 7;
const long long MAX = 1e5 + 7;
const long long MOD = 1e9 + 7;
typedef vector<long long> vi;
typedef vector<vi> vvi;
typedef vector<pair<long long, long long> > vii;
typedef vector<vii> vvii;
typedef vector<bool> vb;
long long N, K;
vi a;
vvi f(MAX, vi(105, -1));
long long solve(long long k, long long n) {
  if (k == 0 && n == -1) return 1;
  if (k < 0 || n < 0) return 0;
  if (f[k][n] != -1) return f[k][n];
  f[k][n] = 0;
  for (long long i = 0; i <= a[n]; i++) {
    f[k][n] = (f[k][n] + solve(k - i, n - 1)) % MOD;
  }
  return (f[k][n] % MOD);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K, a.resize(N);
  for (long long i = 0; i < N; i++) cin >> a[i];
  long long ans = solve(K, N - 1);
  cout << ans << endl;
  return 0;
}
