#include <bits/stdc++.h>
const int N = 103, M = 1e9 + 7;
inline int Mod(int a) { return a < M ? a : a - M; }
int n, m, a[N], f[N][100003];
signed main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int j = 0; j <= m; j++) f[0][j] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= m; j++)
      f[i][j] = Mod((j > 0 ? f[i][j - 1] : 0) +
                    Mod(f[i - 1][j] -
                        (j - a[i] - 1 < 0 ? 0 : f[i - 1][j - a[i] - 1]) + M));
  printf("%d", f[n][m] - (m > 0 ? f[n][m - 1] : 0));
  return 0;
}
