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