#include <bits/stdc++.h>
using namespace std;
const int lim = 3005;
const long long mod = 1000000007;
long long dp[100005][102];
int t[102];
int n, k;
long long pr(int x, int y, int n2) {
  if (x) return (dp[y][n2] - dp[x - 1][n2]) % mod;
  return dp[y][n2];
}
inline void wc(int *n23) {
  register char c23 = 0;
  while (c23 < 33) c23 = getc_unlocked(stdin);
  (*n23) = 0;
  while (c23 > 32) {
    (*n23) = (*n23) * 10LL + (c23 - 48);
    c23 = getc_unlocked(stdin);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  wc(&n);
  wc(&k);
  for (int i = 1; i <= n; i++) wc(&t[i]);
  for (int i = 0; i <= n; i++) dp[0][i] = 1;
  for (int i = 0; i <= k; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[j][i] = pr(max(0, j - t[i]), j, i - 1) + pr(0, j - 1, i);
      dp[j][i] %= mod;
    }
  }
  cout << pr(k, k, n) % mod;
  return 0;
}
