func main() var n: int :: cui@inputInt() var k: int :: cui@inputInt() var a: []int :: #[n]int for i(0, n - 1) do a[i] :: cui@inputInt() end for var rnd: lib@Rnd :: lib@makeRnd(lib@sysTime() $ bit32) var ans: int :: 0 for(1, 5) var map: dict :: #dict var mod: int :: 2 ^ 30 + rnd.rnd(100, 1000) for ii(0, 2 ^ n - 1) var id: int :: ii var use: []bool :: #[n]bool var cnt: int :: 0 for i(0, n - 1) if(id % 2 = 1) do use[i] :: true do cnt :+ 1 end if do id :/ 2 end for if(cnt >= k) var mul: int :: 1 for i(0, n - 1) if(use[i]) do mul :* a[i] do mul :% mod end if end for do map.add(mul, true) var sum: int :: 0 for i(0, n - 1) if(use[i]) do sum :+ a[i] end if end for do map.add(sum, true) end if end for do ans :: [ans, ^map].max() end for do cui@print("\{ans}\n") end func