# not solved
# CPython: TLE
# PyPy: TLE

MOD_VAL = 998244353


def main():
    _, target = [int(v) for v in input().split(' ')]
    nums = [int(v) for v in input().split(' ')]
    dp = [0 for _ in range(target + 1)]
    dp[0] = 1
    ans = 0
    for n in nums:
        tmp_dp = dp.copy()
        for k, v in enumerate(tmp_dp[:-1]):
            if n + k <= target:
                dp[n + k] += v
        dp[0] += 1
        ans = (ans + dp[target]) % MOD_VAL
    print(int(ans))


if __name__ == '__main__':
    main()
