# coding: utf-8
N, S = list(map(int, input().split()))
A = [0]+list(map(int, input().split()))

dt = [[0 for _ in range(S+1)] for x in range(N+1)]

for n in range(1, N+1):
  if A[n] <= S:
    dt[n][A[n]] += n
  for i in range(1,S+1):
    if (i + A[n]) <= S:
      dt[n][i+A[n]] += dt[n-1][i] - dt[n-2][i]
    dt[n][i] += dt[n-1][i] + (dt[n-1][i] - dt[n-2][i])

print(dt[N][S] % 998244353)