#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int k;
  cin >> k;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int dp[n + 1][k + 1];
  int ans = 0;
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      for (int l = 0; l <= min(j, arr[i]); l++) {
        if (j >= l) dp[i + 1][j] = (dp[i + 1][j] + dp[i][j - l]) % 100000007;
      }
    }
  }
  cout << dp[n][k] << endl;
}
