#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  long long a[n + 1];
  long long dp[n + 1][k + 1], sum[n + 1][k + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    dp[i][0] = 1;
    sum[i][0] = 1;
  }
  for (int c = 0; c <= k; c++) {
    if (c <= a[1]) {
      dp[1][c] = 1;
    } else
      dp[1][c] = 0;
    if (c > 0) {
      sum[1][c] = sum[1][c - 1] + dp[1][c];
    }
  }
  for (int i = 2; i <= n; i++) {
    for (int c = 1; c <= k; c++) {
      if (c - a[i] - 1 >= 0) {
        dp[i][c] = sum[i - 1][c] - sum[i - 1][c - a[i] - 1];
      } else
        dp[i][c] = sum[i - 1][c];
      dp[i][c] = (dp[i][c] + 1000000009) % 1000000009;
      sum[i][c] = sum[i][c - 1] + dp[i][c];
      sum[i][c] %= 1000000009;
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
