#![allow(unused_imports)] #![allow(non_snake_case)] use std::cmp::*; use std::collections::*; use std::io::Write; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let v = read_vec::(); let (n, k) = (v[0], v[1]); let v = read_vec::(); if k >= 11 { println!("0"); return; } let mut dp = vec![HashMap::new(); k + 1]; dp[0].insert(0, 1); for num in v { for i in (0..k).rev() { let mut added = vec![]; for &elem in dp[i].keys() { if elem & num == 0 && (elem ^ num).count_ones() as usize <= 10 - (k - i) { added.push(elem ^ num); } } for anum in added { *dp[i + 1].entry(anum).or_insert(0) += 1; //*dp[i + 1].entry(anum).or_insert(0) %= 998244353; } } } let ans = dp[k].values().sum::(); println!("{}", ans); } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }