// use itertools::Itertools; const MOD_998: usize = 998; const MOD_998244353: usize = 998244353; fn main() { let (n, k) = input_tuple::(); let a = input_vec::(); let mut result = 0_usize; // println!("{:?}", combination(&(0..n).collect::>(), k)); // for combination in (0..n).combinations(k) { for combination in combination(&(0..n).collect::>(), k) { let mut s_998 = 0_usize; let mut s_998244353 = 0_usize; for i in combination { s_998 += a[i]; s_998 %= MOD_998; s_998244353 += a[i]; s_998244353 %= MOD_998244353; } if s_998244353 <= s_998 { result += 1; result %= MOD_998; } } println!("{}", result); } fn combination(elems: &Vec, r: usize) -> Vec> { // vector> v{}; let mut v = Vec::new(); // vector v1(r); let mut v1 = vec![0; r]; // int n = elems.size(); let n = elems.len(); rec(n, r, &elems, &mut v, &mut v1, 0, 0, 0); return v; } fn rec( n: usize, r: usize, elems: &Vec, v: &mut Vec>, v1: &mut Vec, bit: usize, now: usize, num_decided: usize, ) { if num_decided == r { // int index = 0; let mut index = 0; // for(int i=0; i 0 { v1[index] = elems[i]; index += 1; } } // v.push_back(v1); v.push(v1.clone()); return; } // if(now == n)return; if now == n { return; } rec( n, r, &elems, v, v1, bit + (1 << now), now + 1, num_decided + 1, ); rec(n, r, &elems, v, v1, bit, now + 1, num_decided); } fn input_tuple() -> (T, T) where T: std::str::FromStr, ::Err: std::fmt::Debug, { let stdin = std::io::stdin(); let mut buf = String::new(); stdin.read_line(&mut buf).unwrap(); buf = buf.trim_end().to_owned(); let mut iter = buf.split_whitespace(); let n = iter.next().unwrap().parse().unwrap(); let m = iter.next().unwrap().parse().unwrap(); (n, m) } fn input_vec() -> Vec where T: std::str::FromStr, ::Err: std::fmt::Debug, { let stdin = std::io::stdin(); let mut buf = String::new(); stdin.read_line(&mut buf).unwrap(); buf = buf.trim_end().to_owned(); let iter = buf.split_whitespace(); let line = iter.map(|x| x.parse().unwrap()).collect(); line }