#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int n, k;
int a[100005];
int dp[105][100005];
int sum[100005];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    sum[0] = 0;
    for (int j = 1; j <= k + 1; j++) sum[j] = sum[j - 1] + dp[i - 1][j - 1];
    for (int j = 1; j <= k; j++)
      dp[i][j] = (sum[j + 1] - sum[max(0, j - a[i])] + mod) % mod;
  }
  printf("%d\n", dp[n][k]);
  return 0;
}
