#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
const int K = 1e5 + 5;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n, k;
int a[N];
int mem[N][K];
int dp(int n, int k) {
  if (n >= 0 & k == 0) return 1;
  if (n <= 0 || k < 0) return 0;
  int &ret(mem[n][k]);
  if (ret != -1) return ret;
  ret = 0;
  for (int j = 0; j <= a[n]; j++) {
    (ret += dp(n - 1, k - j)) %= MOD;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  cerr << "n"
       << " is " << n << endl;
  ;
  cerr << "k"
       << " is " << k << endl;
  ;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    memset(mem[i], -1, sizeof mem[i]);
  }
  int ans = dp(n, k);
  cout << ans << endl;
  return 0;
}
