#include <bits/stdc++.h>
using namespace std;
const long long INF = (1 << 30);
const long long inf = (1LL << 60LL);
const int maxn = 2e5 + 5;
int n, k;
int arr[105];
int dp[maxn];
const int MOD = 1e9 + 7;
int tree[400005];
int lazy[400006];
void build_tree(int node, int a, int b) {
  if (a > b) return;
  if (a == b) {
    tree[node] = 0;
    return;
  }
  build_tree(node * 2, a, (a + b) / 2);
  build_tree(node * 2 + 1, 1 + (a + b) / 2, b);
  tree[node] = (tree[node * 2] + tree[node * 2 + 1]) % MOD;
}
void update_tree(int node, int a, int b, int i, int j, int value) {
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (a != b) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (a > b || a > j || b < i) return;
  if (a >= i && b <= j) {
    tree[node] += value;
    tree[node] %= MOD;
    if (a != b) {
      lazy[node * 2] += value;
      lazy[node * 2 + 1] += value;
    }
    return;
  }
  update_tree(node * 2, a, (a + b) / 2, i, j, value);
  update_tree(1 + node * 2, 1 + (a + b) / 2, b, i, j, value);
  tree[node] = (tree[node * 2] + tree[node * 2 + 1]) % MOD;
}
int query_tree(int node, int a, int b, int i, int j) {
  if (a > b || a > j || b < i) return 0;
  if (lazy[node] != 0) {
    tree[node] += lazy[node];
    if (a != b) {
      lazy[node * 2] += lazy[node];
      lazy[node * 2 + 1] += lazy[node];
    }
    lazy[node] = 0;
  }
  if (a >= i && b <= j) return tree[node];
  int q1 = query_tree(node * 2, a, (a + b) / 2, i, j);
  int q2 = query_tree(1 + node * 2, 1 + (a + b) / 2, b, i, j);
  int res = (q1 + q2) % MOD;
  return res;
}
int main(int argc, const char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(dp, 0, sizeof dp);
  dp[0] = 1;
  build_tree(1, 0, k + 1);
  update_tree(1, 0, k, 0, 0, 1);
  for (int i = 0; i < n; i++) {
    for (int candies = k; candies >= 0; candies--) {
      int L = candies + 1;
      int R = candies + min(arr[i], k - candies);
      int t = query_tree(1, 0, k, candies, candies);
      update_tree(1, 0, k, L, R, t);
    }
  }
  cout << query_tree(1, 0, k, k, k) << endl;
  return 0;
}
