#include <bits/stdc++.h>
using namespace std;
int a[101];
int f[101][100001];
int sum[101][100001];
int main() {
  int n, m, i, j, k;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  f[0][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= m; j++) {
      sum[i][j] = (sum[i][j] + f[i - 1][j]) % 1000007;
      f[i][j] = (f[i][j] + sum[i][j] - sum[i][j - a[i] - 1]) % 1000007;
    }
  }
  printf("%d", f[n][m]);
  return 0;
}
