import numpy as np
from io import StringIO
MOD = 998244353


def main():
    n, s = map(int, input().split())
    a = np.loadtxt(StringIO(input()), dtype=np.int64)
    dp = np.zeros(s + 1, dtype=np.int64)
    ans = 0
    for i in range(n):
        if a[i] > s:
            continue
        dp[0] = i + 1
        dp_next = dp.copy()
        for j in range(s + 1 - a[i]):
            dp_next[j + a[i]] += dp[j]
            dp_next[j + a[i]] %= MOD
        dp = dp_next
        ans += dp[s]
    print(ans)


if __name__ == "__main__":
    main()