#include <bits/stdc++.h>
using namespace std;
long long n, k;
bool chk[105][100005];
long long f[105][100005];
long long a[105];
void open() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void readin() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
}
long long calc(long long i, long long j) {
  if (chk[i][j]) return f[i][j];
  if (i <= 0 || j < 0) return 0;
  chk[i][j] = 1;
  long long &ans = f[i][j];
  for (long long x = 0; x <= a[i]; x++) {
    ans += calc(i - 1, j - x);
    ans %= 1000000007;
  }
  return ans;
}
signed main() {
  open();
  readin();
  cout << calc(n, k);
}
