#include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const int fxx[8][2] = {{0, 1}, {0, -1}, {1, 0},  {-1, 0},
                       {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
template <typename T, typename TT>
ostream& operator<<(ostream& s, pair<T, TT> t) {
  return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, vector<T> t) {
  for (int i = 0; i < ((int)((t).size())); i++) s << t[i] << " ";
  return s;
}
long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long power(long long a, long long b, long long m) {
  long long r = 1;
  a = a % m;
  while (b) {
    if (b & 1) r = r * a % m;
    a = a * a % m;
    b = b >> 1;
  }
  return r;
}
long long dp[101][100001];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  long long arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i <= k; ++i) {
    if (i != 0) dp[0][i] = dp[0][i - 1];
    if (k - i <= arr[0] && i <= k) {
      dp[0][i]++;
    }
    dp[0][i] = dp[0][i] % mod;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      if (j == 0) {
        dp[i][j] = dp[i - 1][min(k, j + arr[i])] % mod;
      } else
        dp[i][j] =
            (dp[i][j - 1] + dp[i - 1][min(k, j + arr[i])] - dp[i - 1][j - 1]);
      dp[i][j] = dp[i][j] % mod;
    }
  }
  if (dp[n - 1][0] < 0)
    cout << dp[n - 1][0] + mod << "\n";
  else
    cout << dp[n - 1][0] << "\n";
}
