#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long dp[109][100010];
long long dp2[109][100010];
long long a[109];
const long long mod = 1e7;
long long sum(int i, int left, int right) {
  if (left != 0) {
    return dp2[i][right] - dp2[i][left - 1];
  }
  return dp2[i][right];
}
int main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (i == 1) {
        if (j <= a[i]) {
          dp[i][j] = 1;
        }
      } else if (j - a[i] >= 0) {
        dp[i][j] = (dp2[i - 1][j] - dp2[i - 1][j - a[i] - 1] + mod) % mod;
      } else {
        dp[i][j] = (dp2[i - 1][j] + mod) % mod;
      }
      if (j == 0) {
        dp2[i][j] = 1;
      } else {
        dp2[i][j] = (dp2[i][j - 1] + dp[i][j] + mod) % mod;
      }
    }
  }
  cout << dp[n][k] % mod;
}
