n,s=map(int,input().split())
a=list(map(int,input().split()))
m=998244353
def f(a1,s1,x):
  l=len(a1)
  y=x
  if y==0:
    y=n-l+1
  if a1[0]==s1:
    if l==1:
      return y*l%m
    else:
      return (y*l+f(a1[1:],s1,x))%m
  elif l==1:
    return 0
  elif a1[0]>s1:
    return f(a1[1:],s1,x)
  else:
    return (f(a1[1:],s1,x)+f(a1[1:],s1-a1[0],y))%m
print(f(a,s,0))