from functools import lru_cache
import sys

sys.setrecursionlimit(10**5)

def solve(nums, s):
    @lru_cache(None)
    def dfs(i, k):
        if k < 0:
            return []
        if k == 0:
            return [i-1]
        if i >= n:
            return []
        if k == s:
            return dfs(i+1, k-nums[i])
        return dfs(i+1, k-nums[i]) + dfs(i+1, k)

    ans = 0
    n = len(nums)
    for i in range(n):
        for e in dfs(i, s):
            ans = (ans + (i+1)*(n-e)) % 998244353
    return ans


def main():
    n, s = map(int, input().split())
    nums = [int(c) for c in input().split()]
    print(solve(nums, s))


if __name__ == "__main__":
    main()

