#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 111, N2 = 1e2 + 11;
long long dp[N2][N], cum[N];
int arr[N2];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) scanf("%d", arr + i);
  dp[n][0] = 1;
  for (int i = 0; i <= k; i++) cum[i + 1] = 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j <= k; j++)
      dp[i][j] = cum[j + 1] - cum[max(j - arr[i], 0)];
    for (int j = 0; j <= k; j++) cum[j + 1] = (cum[j] + dp[i][j]) % mod;
  }
  cout << dp[0][k];
}
