# -*- coding: utf-8 -*-
import sys
input = sys.stdin.buffer.readline

sys.setrecursionlimit(10**6)


def read_int_n():
    return list(map(int, input().split()))


def slv2(N, S, A):
    from functools import lru_cache, reduce

    M = 998244353

    @lru_cache(maxsize=None)
    def f(i, s):
        if i < 0:
            if s == 0:
                return 1
            else:
                return 0

        if s < 0:
            return 0
        elif s == 0:
            return f(i-1, s) + 1

        return (f(i-1, s-A[i]) + f(i-1, s)) % M

    ans = 0
    for i in range(N-1, -1, -1):
        ans += f(i, S)
        ans %= M
    return ans


def slv(N, S, A):
    M = 998244353
    ans = 0

    dp = [0] * (S+1)
    for a in A:
        dp[0] += 1
        ndp = [0] * (S+1)
        for j in range(S+1):
            ndp[j] += dp[j]
            ndp[j] %= M
            if j+a <= S:
                ndp[j+a] += dp[j]
                ndp[j+a] %= M
        dp = ndp
        ans += dp[S]
        ans %= M

    return ans


def main():
    N, S = read_int_n()
    A = read_int_n()
    # print(slv(N, S, A))
    print(slv2(N, S, A))


if __name__ == '__main__':
    main()
