from sys import stdin

mod = 998244353

def main():

    N,S = list(map(int,stdin.readline().split()))

    a = list(map(int,stdin.readline().split()))

    dp = [0]*(S+1)

    ans = 0

    for A in a:

        dp[0] += 1

        for i in reversed(list(range(A,S+1))):

            dp[i] += dp[i-A]    

            dp[i] %= mod

        ans += dp[S]

        ans %= mod

    print(ans)

if __name__ == "__main__":

    main()

from sys import stdin

mod = 998244353

def solveAsPolynomial():

    import numpy as np

    N,S = list(map(int,stdin.readline().split()))

    a = list(map(int,stdin.readline().split()))

    ans = 0

    f = np.zeros(S+1,np.int64)#f[k] := ある多項式のx**kの係数

    for A in a:

        #f = (f+1)(1+x**A)として更新していく

        f[0] += 1#f+1

        f[A:] += f[:-A].copy()#f*(1+x**A)

        f %= mod

        ans += f[S]

        #x**S = X**(A_1+...+A_k)ゆえ、f[S]は知りたい組み合わせの数と等しい

        ans %= mod

    return ans

def main():

  ans = solveAsPolynomial()

  print(ans)

if __name__ =="__main__":

  main()

from sys import stdin

mod = 998244353


def main():
    N, S = list(map(int, stdin.readline().split()))
    a = list(map(int, stdin.readline().split()))
    dp = [0] * (S + 1)
    ans = 0
    for A in a:
        dp[0] += 1
        for i in reversed(list(range(A, S + 1))):
            dp[i] += dp[i - A]
            dp[i] %= mod
        ans += dp[S]
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()

from sys import stdin

mod = 998244353


def solveAsPolynomial():
    import numpy as np

    N, S = list(map(int, stdin.readline().split()))
    a = list(map(int, stdin.readline().split()))
    ans = 0
    f = np.zeros(S + 1, np.int64)  # f[k] := ある多項式のx**kの係数
    for A in a:
        # f = (f+1)(1+x**A)として更新していく
        f[0] += 1  # f+1
        f[A:] += f[:-A].copy()  # f*(1+x**A)
        f %= mod
        ans += f[S]
        # x**S = X**(A_1+...+A_k)ゆえ、f[S]は知りたい組み合わせの数と等しい
        ans %= mod
    return ans


def main():
    ans = solveAsPolynomial()
    print(ans)


if __name__ == "__main__":
    main()

-def main(): +def solveAsPolynomial(): +    import numpy as np + -    dp = [0] * (S + 1) +    f = np.zeros(S + 1, np.int64)  # f[k] := ある多項式のx**kの係数 -        dp[0] += 1 -        for i in reversed(list(range(A, S + 1))): -            dp[i] += dp[i - A] -            dp[i] %= mod -        ans += dp[S] +        # f = (f+1)(1+x**A)として更新していく +        f[0] += 1  # f+1 +        f[A:] += f[:-A].copy()  # f*(1+x**A) +        f %= mod +        ans += f[S] +        # x**S = X**(A_1+...+A_k)ゆえ、f[S]は知りたい組み合わせの数と等しい +    return ans + + +def main(): +    ans = solveAsPolynomial()