
def solve(N, S, A):
    k = {}
    M = 998244353
    ans = 0
    s = 0
    for i, a in enumerate(A):
        if a == S:
            ans += (i + 1) * (N - i)
            ans %= M
        else:
            comp = S - a
            if comp in k:
                js = k[comp]
                for j in js:
                    ans += (j + 1) * (N - i)
                    ans %= M

            new_k = {}
            for key, value in k.items():
                if key+a < S:
                    new_k.setdefault(key+a, []).extend(value)
            if a < S:
                new_k.setdefault(a, []).append(i)

            for key, value in new_k.items():
                if key < S:
                    k.setdefault(key, []).extend(value)
    return ans % M

# print(solve(3, 4,[2,2,4]))
# print(solve(5, 8,[9,9,9,9,9]))
# print(solve(10, 10,[3,1,4,1,5,9,2,6,5,3]))

if __name__ == "__main__":
    N, S = tuple(map(int, input().split(" ")))
    A = list(map(int, input().split(" ")))
    print(solve(N, S, A))
