#include <bits/stdc++.h>
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dx2[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy2[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int inf = 1000000001;
const long long INF = 1e18 * 4;
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  int a[101];
  for (__typeof(N) i = (0) - ((0) > (N)); i != (N) - ((0) > (N));
       i += 1 - 2 * ((0) > (N)))
    cin >> a[i];
  int** dp = new int*[102];
  for (__typeof(102) i = (0) - ((0) > (102)); i != (102) - ((0) > (102));
       i += 1 - 2 * ((0) > (102))) {
    dp[i] = new int[100001];
  }
  for (__typeof(100001) k = (1) - ((1) > (100001));
       k != (100001) - ((1) > (100001)); k += 1 - 2 * ((1) > (100001)))
    dp[N][k] = 0;
  for (__typeof(102) i = (0) - ((0) > (102)); i != (102) - ((0) > (102));
       i += 1 - 2 * ((0) > (102)))
    dp[i][0] = 1;
  for (int k = 0; k <= K; k++) {
    for (int i = N; i >= 0; i--) {
      if (k - a[i] < 0) {
        dp[i][k + 1] = (dp[i][k] + dp[i + 1][k + 1]) % 1000000007;
      } else {
        dp[i][k + 1] =
            (dp[i][k] + dp[i + 1][k + 1] - dp[i + 1][k - a[i]]) % 1000000007;
      }
    }
  }
  cout << dp[0][K] << endl;
  for (__typeof(102) i = (0) - ((0) > (102)); i != (102) - ((0) > (102));
       i += 1 - 2 * ((0) > (102)))
    delete[] dp[i];
  delete[] dp;
  return 0;
}
