import sys
input=lambda: sys.stdin.readline().rstrip()
n,s=map(int,input().split())
A=[int(i) for i in input().split()]
mod=998244353
B=[[[] for i in range(s+1)] for _ in range(n+1)]
ans=0
for i in range(n):
  a=A[i]
  if a<=s:
    B[i+1][a]+=[i+1]
  for j in range(s+1):
    B[i+1][j]+=B[i][j]
    if j-a>=0 and B[i][j-a]:
      B[i+1][j]+=B[i][j-a]
    
  while B[i+1][s]:
    aa=B[i+1][s].pop()
    ans=(ans+aa*(n-i))%mod
print(ans)