N,S = list(map(int,input().split()))
A = list(map(int,input().split()))
mod =998244353
from collections import defaultdict as dd
from collections import Counter
s_dict = dd(Counter)
res = 0
for idx,a in enumerate(A):
  s_dict_n = dd(Counter)  
  for k,l in s_dict.items():
    for kk,c in l.items():
      s_dict_n[k][kk] = c
  for key, list_of_int in s_dict.items():
    for start_idx in list_of_int:
      if a+key<S:
        s_dict_n[a+key][start_idx]+=1
      elif a + key ==S:
        # print("here",a,key,"->",start_idx,idx,"->",(start_idx+1),"*",(N-idx),s_dict_n[key][start_idx])
        res += (start_idx+1)*(N-idx)*s_dict_n[key][start_idx] %mod
  if a == S:
    # print("here",a,(idx+1),(N-idx))
    res += (idx+1)*(N-idx)%mod
  else:
    s_dict_n[a][idx]+=1
  s_dict = s_dict_n
print(res%mod)