from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
input=lambda :sys.stdin.readline().rstrip()
class SegmentTree(object):

    def __init__(self, init_array, seg_func=min, seg_func_null=10 ** 9 + 7):

        self.seg_func = seg_func
        self.seg_func_null = seg_func_null
        self.n = 1
        while self.n < len(init_array):
            self.n *= 2
        self.dat = [0] * (2 * self.n - 1)
        for i in range(len(init_array)):
            self.dat[self.n - 1 + i] = init_array[i]
        for i in range(self.n - 2, -1, -1):
            self.dat[i] = self.seg_func(self.dat[2 * i + 1], self.dat[2 * i + 2])

    def update(self, k, a):
        k += self.n - 1
        self.dat[k] = a
        while k > 0:
            k = (k - 1) // 2
            self.dat[k] = self.seg_func(self.dat[k * 2 + 1], self.dat[k * 2 + 2])

    def query(self, p, q):
        # [p, q)

        q+=1
        # [p, q]
        if q <= p:
            return self.seg_func_null

        p += self.n - 1
        q += self.n - 2
        res = self.seg_func_null

        while q - p > 1:
            if p & 1 == 0:
                res = self.seg_func(res, self.dat[p])
            if q & 1 == 1:
                res = self.seg_func(res, self.dat[q])
                q -= 1
            p = p // 2
            q = (q-1) // 2
        if p == q:
            res = self.seg_func(res, self.dat[p])
        else:
            res = self.seg_func(self.seg_func(res, self.dat[p]), self.dat[q])

        return res

def dicsum(dic1,dic2):
    dic=defaultdict(int)
    if type(dic1)!=type(1):
        for a in dic1:
            dic[a]+=dic1[a]
    if type(dic2)!=type(1):
        for a in dic2:
            dic[a]+=dic2[a]
    return(dic)



N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
data=[defaultdict(int) for i in range(N)]
for i in range(N):
    data[i][A[i]]+=1
seg = SegmentTree(data, dicsum, -1)

ite=list(combinations_with_replacement(range(N),2))
count=0
for p,q in ite:
    dic=defaultdict(int)
    dica=seg.query(p,q)
    for a in dica:
        for i in range(dica[a]):
            for n in list(dic):
                dic[n+a]+=1
            dic[a]+=1
    count+=dic[S]
    #print(dic,p,q)
print(count%mod)
    #print(seg.query(p,q))
