#include <bits/stdc++.h>
using namespace std;
void FREOPEN() {}
inline double Time() { return (clock() * 1.0) / CLOCKS_PER_SEC; }
const int N = 100500, inf = 1e9 * 2;
const long long MOD = 1e9 + 7ll, INF = 1e18;
const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
int t[2][N * 4];
int a[N];
void build(int ty, int v, int l, int r) {
  t[ty][v] = 0;
  if (l == r) return;
  int mid = (l + r) / 2;
  build(ty, v + v, l, mid);
  build(ty, v + v + 1, mid + 1, r);
}
int get(int ty, int v, int l, int r, int L, int R) {
  if (L > R || l > R || r < L) return 0;
  if (L <= l && R >= r) return t[ty][v];
  int mid = (l + r) / 2;
  int ret = get(ty, v + v, l, mid, L, R);
  ret += get(ty, v + v + 1, mid + 1, r, L, R);
  if (ret >= MOD) ret -= MOD;
  return ret;
}
void upd(int ty, int v, int l, int r, int pos, int x) {
  if (l == r) {
    t[ty][v] = x;
    return;
  }
  int mid = (l + r) / 2;
  if (pos <= mid)
    upd(ty, v + v, l, mid, pos, x);
  else
    upd(ty, v + v + 1, mid + 1, r, pos, x);
  t[ty][v] = t[ty][v + v] + t[ty][v + v + 1];
  if (t[ty][v] >= MOD) t[ty][v] -= MOD;
}
int main() {
  FREOPEN();
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%d ", &a[i]);
  upd(0, 1, 0, k, 0, 1);
  for (int i = 1; i <= n; i++) {
    build(i & 1, 1, 0, k);
    for (int j = 0; j <= k; j++) {
      upd(i & 1, 1, 0, k, j, get((i - 1) & 1, 1, 0, k, max(0, j - a[i]), j));
    }
  }
  printf("%d", get(n & 1, 1, 0, k, k, k));
  return 0;
}
