#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long _INF = 0xc0c0c0c0c0c0c0c0;
const long long mod = (int)1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long ksm(long long a, long long b, long long mod) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long inv2(long long a, long long mod) { return ksm(a, mod - 2, mod); }
void exgcd(long long a, long long b, long long &x, long long &y, long long &d) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    exgcd(b, a % b, y, x, d);
    y -= x * (a / b);
  }
}
void add_self(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
void sub_self(int &a, int b) {
  a -= b;
  if (a < 0) {
    a += mod;
  }
}
int dp[100025], sum[100025];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  dp[0] = 1;
  for (int child = 0; child < n; ++child) {
    int up_to;
    scanf("%d", &up_to);
    for (int used = k; used >= 0; --used) {
      int tmp = dp[used];
      int L = used + 1;
      int R = used + min(up_to, k - used);
      if (L <= R) {
        add_self(sum[L], tmp);
        if (R + 1 <= k) {
          sub_self(sum[R + 1], tmp);
        }
      }
    }
    int presum = 0;
    for (int i = 0; i <= k; ++i) {
      add_self(presum, sum[i]);
      add_self(dp[i], presum);
    }
  }
  printf("%d\n", dp[k]);
  return 0;
}
