#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*[100002];
  for (__typeof(100001) i = (0) - ((0) > (100001));
       i != (100001) - ((0) > (100001)); i += 1 - 2 * ((0) > (100001))) {
    dp[i] = new int[102];
  }
  for (__typeof(K + 1) k = (0) - ((0) > (K + 1));
       k != (K + 1) - ((0) > (K + 1)); k += 1 - 2 * ((0) > (K + 1)))
    dp[k][N] = 0;
  for (__typeof(N + 1) j = (0) - ((0) > (N + 1));
       j != (N + 1) - ((0) > (N + 1)); j += 1 - 2 * ((0) > (N + 1)))
    dp[0][j] = 1;
  for (int i = N - 1; i >= 0; i--) {
    for (int k = 0; k <= K; k++) {
      if (k - a[i] >= 0) {
        dp[k + 1][i] =
            (dp[k][i] - dp[k - a[i]][i + 1] + dp[k + 1][i + 1]) % 1000000007;
      } else {
        dp[k + 1][i] = (dp[k][i] + dp[k + 1][i + 1]) % 1000000007;
      }
    }
  }
  cout << dp[K][0];
  for (__typeof(100001) i = (0) - ((0) > (100001));
       i != (100001) - ((0) > (100001)); i += 1 - 2 * ((0) > (100001)))
    delete[] dp[i];
  delete[] dp;
  return 0;
}
