import numpy as np
def main():
    N,S = map(int, input().split())
    A = np.array(list(map(int,input().split())))


    ans = 0
    for i in range(N):
        ansi = 0
        l = np.array([0])
        for j in range(i,N):
            if A[j]>S: continue
            ansi += sum( l == (S-A[j])) 
            ans += ansi
            ans = ans%998244353
            r = l + A[j]
            r.sort()
            t = 0
            for k in range(len(r),0,-1):
                if r[k-1] <= S:
                    t = k
                    break
            l = np.hstack((l,r[:t]))
    print(ans)
    
    return

if __name__ == "__main__":
    main()