#include <bits/stdc++.h>
using namespace std;
int n, k, arr[105], dp[105][100005], FWT[105][100005];
int sum(int a, int b) {
  return ((a % 1000000007) + (b % 1000000007)) % 1000000007;
}
void update(int ind, int x, int v) {
  x += 1;
  for (x; x <= 100000; x += x & -x) {
    FWT[ind][x] = sum(FWT[ind][x], v);
  }
}
int query(int ind, int x) {
  x += 1;
  int ret = 0;
  for (x; x > 0; x -= x & -x) ret = sum(ret, FWT[ind][x]);
  return ret;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i <= arr[0]; i++) {
    dp[0][i] = 1;
    update(0, i, 1);
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = query(i - 1, j) - query(i - 1, max(-1, j - arr[i] - 1));
      update(i, j, dp[i][j]);
    }
  }
  cout << max(0, dp[n - 1][k]);
  return 0;
}
