n,s = map(int,input().split())
A = list(map(int,input().split()))
MOD  = 998244353

dp  = {0:(0,0)}

for i in range(n):
  a = A[i]
  eph = {}
  for j in dp:
    if j==0:
      eph[a] = [(i+1,i+1)]
      continue
    if j+a > s:
      continue
    eph[j+a] = [(k[0],i+1) for k in dp[j]] 
  for e in eph:
    if e in dp:
      dp[e].extend(eph[e])
    else:
      dp[e] = eph[e]
if s in dp:
  cand = dp[s]
else:
  print(0)
  exit()

  
  



ans = 0
index = 0
for l,r in cand:
  ans += ((l)*(n-r+1)) % MOD
  ans %= MOD
print(ans)