#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int dp[101][100001];
int cumil[101][100001];
int n, k;
int arr[101];
int pre[101];
int main() {
  cin >> n >> k;
  for (int x = 1; x <= n; x++) cin >> arr[x];
  for (int x = 1; x <= n; x++) {
    pre[x] = pre[x - 1] + arr[x];
  }
  for (int x = 0; x <= k; x++) {
    if (x > arr[1]) {
      cumil[1][x] = cumil[1][x - 1];
      continue;
    }
    if (arr[1] >= x) dp[1][x] = 1;
    cumil[1][x] = x + 1;
  }
  for (int x = 2; x <= n; x++) {
    for (int y = 0; y <= k; y++) {
      if (pre[x] < y) break;
      dp[x][y] += cumil[x - 1][min(arr[x], y)];
      if (arr[x] < y) dp[x][y] -= cumil[x - 1][y - arr[x] - 1];
      if (y == 0)
        cumil[x][y] = dp[x][y];
      else
        cumil[x][y] = dp[x][y] + cumil[x][y - 1];
      cumil[x][y] %= mod;
    }
  }
  cout << (dp[n][k] % mod + mod) % mod << endl;
}
