use std::cmp::min;
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let mut itr = s.split_whitespace().map(|e| e.parse::<usize>().unwrap());
    let n = itr.next().unwrap();
    let k = itr.next().unwrap();
    let m = 998244353;
    s.clear();
    stdin().read_line(&mut s).ok();

    let v: Vec<usize> = s
        .split_whitespace()
        .map(|e| e.parse::<usize>().unwrap())
        .collect();

    let mut a = vec![0; k + 1];
    let mut ans = 0;
    for i in 0..n {
        a[0] += 1;
        let mut a2 = vec![0; k + 1];
        for j in 0..k + 1 {
            a2[j] = (a2[j] + a[j]) % m;
            if j + v[i] <= k {
                a2[j + v[i]] = (a2[j + v[i]] + a[j]) % m;
            }
        }

        a = a2;

        ans = (ans + a[k]) % m;
    }

    println!("{}", ans);
}
