import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 998244353
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,s = inpm()
    a = inpl()
    if sum(a)<s or min(a)>s:
        print(0)
        return
    past = deque()
    past.append([0,-1])
    ans = 0
    for i in range(n):
        for _ in range(len(past)):
            [x,y] = past.popleft()
            if y == -1:
                Next = [x+a[i],i]
            else:
                Next = [x+a[i],y]
            if Next[0] == s:
                if y == -1:
                    ans += (i+1)*(n-i)
                else:
                    ans += (y+1)*(n-i)
                ans %= mod
            elif Next[0] < s:
                past.append(Next)
            past.append([x,y])
    print(ans)


if __name__ == "__main__":
    main()