#include <bits/stdc++.h>
using namespace std;
const int N = 105, K = 100005, M = 1e9 + 7;
int n, k, a[N];
long long dp[N][2 * K + 5];
void update(int i, int j, int v) {
  j += k;
  dp[i][j] = v;
  j /= 2;
  while (j) {
    dp[i][j] = (dp[i][2 * j] + dp[i][2 * j + 1]) % M;
    j /= 2;
  }
}
long long get(int i, int l, int r) {
  l += k;
  r += k;
  long long ret = 0;
  while (r > l) {
    if (l & 1) ret = (ret + dp[i][l++]) % M;
    if (r & 1) ret = (ret + dp[i][--r]) % M;
    l /= 2;
    r /= 2;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j <= k; j++) {
      if (i == n - 1) {
        if (j <= a[i]) {
          update(i, j, 1);
        }
      } else {
        update(i, j, get(i + 1, max(0, j - a[i]), j + 1));
      }
    }
  }
  cout << dp[0][k + k];
}
