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