#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5, mod = 1e9 + 7;
int n, a[maxn], k;
long long f[101][maxn];
long long dp(int i, int k) {
  if (i > n) return (k == 0);
  long long &res = f[i][k];
  if (res != -1) return res;
  res = 0;
  int x = min(k, a[i]);
  for (int j = 0; j <= x; ++j) res = (res + dp(i + 1, k - j)) % mod;
  return res;
}
int main() {
  memset(f, 255, sizeof(f));
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  cout << dp(1, k);
  return 0;
}
