#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, K;
  cin >> n >> K;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long dp[100][100001];
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j <= K; j++) dp[i][j] = 0;
  for (long long i = a[n - 1]; i >= 0; i--) dp[n - 1][i] = 1;
  long long md = 1000000007;
  for (long long i = n - 2; i >= 0; i--) {
    for (long long j = 0; j <= K; j++) {
      if (j <= a[i]) dp[i][j] = (dp[i][j] + dp[i + 1][K - j]) % md;
    }
  }
  cout << dp[0][K];
  return 0;
}
