#include <bits/stdc++.h>
using namespace std;
int d[105][100005], n, k, i, a[106];
int dp(int i, int x) {
  if (i == n || x <= 0) return x == 0;
  if (d[i][x] != -1) return d[i][x];
  d[i][x] = 0;
  for (int j = 0; j <= a[i] && x - j >= 0; j++)
    d[i][x] = (d[i][x] + dp(i + 1, x - j)) % 1000000007;
  return d[i][x];
}
int main() {
  memset(d, -1, sizeof d);
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  cout << dp(0, k);
  return 0;
}
