ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

2110. Remove or Maximize

Time limit: 2.0 second
Memory limit: 64 MB
You have an array of n integers. But n integers is too much for you, so you want to remove exactly k integers from them. You should select these k integers in such a way that bitwise OR of the remaining integers would be maximal possible.
It’s guaranteed that in any test either k ≤ 7, or all integers in the array are not greater than 105.

Input

The first line contains integers n and k (0 ≤ k ≤ 100; k + 1 ≤ n ≤ 105). The second line describes the given array as a sequence of n integers. All integers in the array are from 0 to 109.

Output

Output maximal possible value of bitwise OR of the remaining integers.

Samples

inputoutput
4 1
32 16 8 7
56
4 1
98765432 98765432 98765432 1
98765433

Notes

To calculate a bitwise OR of two integers you should write them in the binary form and perform the OR operation for each pair of corresponding bits. If both bits are 0, then this bit of result is 0, otherwise this bit of result is 1.
Problem Author: Alexey Danilyuk
Problem Source: Ural FU Junior Championship 2016