#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7, M = 2e6;
const long long mod = 1e9 + 7;
inline int read() {
  int ret = 0;
  char ch = getchar();
  bool f = 1;
  for (; !isdigit(ch); ch = getchar()) f ^= !(ch ^ '-');
  for (; isdigit(ch); ch = getchar()) ret = (ret << 1) + (ret << 3) + ch - 48;
  return f ? ret : -ret;
}
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); }
long long dp[110][110000], arr[110000];
int a[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  if (k == 0) {
    puts("1");
    return 0;
  }
  arr[0] = 1;
  for (int i = 1; i <= k; i++) {
    if (i <= a[1])
      arr[i] = arr[i - 1] + 1;
    else
      arr[i] = arr[i - 1];
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i][j] =
          ((j - a[i] - 1 < 0 ? arr[j] : arr[j] - arr[j - a[i] - 1]) + mod) %
          mod;
    }
    for (int j = 1; j <= k; j++) {
      arr[j] = arr[j - 1] + dp[i][j];
      arr[j] %= mod;
    }
  }
  printf("%lld\n", dp[n][k]);
  return 0;
}
