const INF: usize = 1usize << 60; fn main() { let mut nk = String::new(); std::io::stdin().read_line(&mut nk).ok(); let nk: Vec = nk.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nk[0]; let k = nk[1]; let mut a = String::new(); std::io::stdin().read_line(&mut a).ok(); let a: Vec = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let mut other_mins = vec![INF; 1<> j) & 1) == 0).map(|j| a[j]).min().unwrap_or(INF); } let mut dp = vec![0usize; 1<> j) & 1) == 1 { continue; } let idx = i | (1 << j); if dp[idx] % other_mins[idx] < dp[i] % a[j] % other_mins[idx] { dp[idx] = dp[i] % a[j]; } } } println!("{}", dp[(1<