import unittest


class TestF(unittest.TestCase):
    def test_1(self):
        self.assertEqual(
            think(
                4,
                [2, 2, 4]
            ),
            5
        )

    def test_2(self):
        self.assertEqual(
            think(
                8,
                [9, 9, 9, 9, 9]
            ),
            0
        )

    def test_3(self):
        self.assertEqual(
            think(
                10,
                [3, 1, 4, 1, 5, 9, 2, 6, 5, 3]
            ),
            152
        )


def solve():
    s, a = read()
    result = think(s, a)
    write(result)


def read():
    n, s = read_int(2)
    return s, read_int(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(s, a):
    # FIXME:
    mode = 998244353
    count = 0

    list_of_range = calc_list_of_range(a, s)
    for left in range(len(a)):
        for right in range(left, len(a)):
            left_index = find_left_index_from(list_of_range, left)
            right_index = find_right_index_from(list_of_range, right)

            if left_index is None or right_index is None:
                continue
            if left_index > right_index:
                continue
            count += right_index - left_index + 1
            count %= mode

    return count


def calc_list_of_range(a, s):
    # shakutori method, "two pointers" method
    n = len(a)

    left = 0
    right = 0
    subsum = 0

    list_of_range = []
    need_to_add_right = True

    while left < n and right < n:
        if need_to_add_right:
            subsum += a[right]

        if subsum == s:
            list_of_range.append((left, right))
            need_to_add_right = True
            right += 1
        else:
            if subsum < s:
                need_to_add_right = True
                right += 1
            else:
                need_to_add_right = False
                subsum -= a[left]
                left += 1
            if right < left:
                right = left
                need_to_add_right = True

    return list_of_range


def find_left_index_from(list_of_range, left):
    if not list_of_range:
        return None

    list_of_boundary_left = [x[0] for x in list_of_range]
    if list_of_boundary_left[-1] < left:
        return None
    if list_of_boundary_left[0] >= left:
        return 0

    left_index = 0
    right_index = len(list_of_boundary_left) - 1
    while right_index - left_index > 1:
        mid_index = (left_index + right_index) // 2
        if list_of_boundary_left[mid_index] >= left:
            left_index = mid_index
        else:
            right_index = mid_index
    return right_index


def find_right_index_from(list_of_range, right):
    if not list_of_range:
        return None

    list_of_boundary_right = [x[1] for x in list_of_range]
    if list_of_boundary_right[0] > right:
        return None
    if list_of_boundary_right[-1] <= right:
        return len(list_of_boundary_right) - 1

    left_index = 0
    right_index = len(list_of_boundary_right) - 1
    while right_index - left_index > 1:
        mid_index = (left_index + right_index) // 2
        if list_of_boundary_right[mid_index] <= right:
            left_index = mid_index
        else:
            right_index = mid_index
    return left_index


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()