n, s = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

sum = Array.new(s+1) {[]}

a.each_with_index do |e, idx|
    next if e > s

    1.upto(s) do |i|
        break if i + e > s
        next if sum[i].empty?
        sum[i + e] << [sum[i].inject([]){|r,v| v[1] == idx ? r : r + v[0]}, idx]
    end

    sum[e] << [[idx], idx]
end

ans = 0
mod = 998244353
sum[s].each do |arr, r|
    arr.each do |l|
        ans = (ans + (l + 1) * (n - r)) % mod
    end
end

puts ans