#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  long arr[100];
  for (int i = 0; i < n; i++) cin >> arr[i];
  long dp[101][100001];
  long tc = 0;
  for (int i = 0; i <= n; i++) {
    if (i > 0) tc += arr[i - 1];
    for (int j = 0; j <= k; j++) {
      if (i == 0 || j > tc)
        dp[i][j] = 0;
      else if (j == 0)
        dp[i][j] = 1;
      else if (arr[i - 1] >= j)
        dp[i][j] = (dp[i - 1][j] % 1000000007 + dp[i][j - 1] % 1000000007) %
                   1000000007;
      else
        dp[i][j] = max(dp[0][0], (dp[i][j - 1] + dp[i - 1][j - 1] -
                                  dp[i - 1][j - arr[i - 1]] + 1000000007) %
                                     1000000007);
    }
  }
  long ans = dp[n][k] % 1000000007;
  cout << ans << endl;
}
