Mr. Suraj is the head chef at a restaurant. He has a cabinet in his kitchen where he keeps the delicious cookies he makes. The cookies are kept in separate jars and each jar is assigned a number which is equal to the number of cookies present inside that jar.
He defines the value of a cabinet as the sum of the numbers assigned to each jar.
Due to some circumstances Mr. Suraj had to shift his restaurant to a new locality situated just near MANIT. He came to know that at the new place, he will not have a single cabinet but exactly M cabinets . He decided that the intensity of the M cabinets is the bitwise AND of the values of all the cabinets.
He is kind of a lazy person so he decided not to reorder the jars, so he will place several first jars in the first cabinet, several next jars in the second cabinet and so on. Of course, he will place at least one jar on each cabinet. He is required to put all of his cookie jars in the k cabinets in such a way that the intensity of the cabinets is as large as possible.
You need to calculate the maximum possible intensity.
The first line contains two integers n and m (1 ≤ m ≤ n ≤ 50) — the number of jars and the number of cabinets in the new restaurant.
The second line contains n integers a1, a2 , …an (0 < ai <250) — the no of cookies in each jar in the order they stand in the old cabinet.
Print the maximum possible intensity of M cabinets in the new office.
In the first example you can split the jars as follows:
(9+14+28+1+7) & (13+15) & (29+2) & (31)=24