# -*- coding: utf-8 -*-

import bisect

import heapq

import math

import random

import sys

from collections import Counter, defaultdict, deque

from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal

from functools import lru_cache, reduce

from itertools import combinations, combinations_with_replacement, product, permutations

from operator import add, mul, sub



sys.setrecursionlimit(100000)

input = sys.stdin.readline

INF = 2**62-1





def read_int():

    return int(input())





def read_int_n():

    return list(map(int, input().split()))





def read_float():

    return float(input())





def read_float_n():

    return list(map(float, input().split()))





def read_str():

    return input().strip()





def read_str_n():

    return list(map(str, input().split()))





def error_print(*args):

    print(*args, file=sys.stderr)





def mt(f):

    import time



    def wrap(*args, **kwargs):

        s = time.time()

        ret = f(*args, **kwargs)

        e = time.time()



        error_print(e - s, 'sec')

        return ret



    return wrap





class Mod:

    def __init__(self, m):

        self.m = m



    def add(self, a, b):

        return (a + b) % self.m



    def sub(self, a, b):

        return (a - b) % self.m



    def mul(self, a, b):

        return ((a % self.m) * (b % self.m)) % self.m



    def div(self, a, b):

        return self.mul(a, pow(b, self.m-2, self.m))



    def pow(self, a, b):

        return pow(a, b, self.m)





@mt

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))





if __name__ == '__main__':

    main()

# -*- coding: utf-8 -*-

import sys

input = sys.stdin.buffer.readline





def read_int_n():

    return list(map(int, input().split()))





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)))





if __name__ == '__main__':

    main()

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62 - 1


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()
        error_print(e - s, "sec")
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m - 2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


@mt
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))


if __name__ == "__main__":
    main()

# -*- coding: utf-8 -*-
import sys

input = sys.stdin.buffer.readline


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


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)))


if __name__ == "__main__":
    main()

-import bisect -import heapq -import math -import random -from collections import Counter, defaultdict, deque -from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal -from functools import lru_cache, reduce -from itertools import combinations, combinations_with_replacement, product, permutations -from operator import add, mul, sub -sys.setrecursionlimit(100000) -input = sys.stdin.readline -INF = 2**62 - 1 - - -def read_int(): -    return int(input()) +input = sys.stdin.buffer.readline -def read_float(): -    return float(input()) - - -def read_float_n(): -    return list(map(float, input().split())) - - -def read_str(): -    return input().strip() - - -def read_str_n(): -    return list(map(str, input().split())) - - -def error_print(*args): -    print(*args, file=sys.stderr) - - -def mt(f): -    import time - -    def wrap(*args, **kwargs): -        s = time.time() -        ret = f(*args, **kwargs) -        e = time.time() -        error_print(e - s, "sec") -        return ret - -    return wrap - - -class Mod: -    def __init__(self, m): -        self.m = m - -    def add(self, a, b): -        return (a + b) % self.m - -    def sub(self, a, b): -        return (a - b) % self.m - -    def mul(self, a, b): -        return ((a % self.m) * (b % self.m)) % self.m - -    def div(self, a, b): -        return self.mul(a, pow(b, self.m - 2, self.m)) - -    def pow(self, a, b): -        return pow(a, b, self.m) - - -@mt -    print(slv(N, S, A)) +    print((slv(N, S, A)))