{"raw_statement":[{"iden":"problem statement","content":"One day, Niwango-kun, an employee of Dwango Co., Ltd., found an integer sequence $(a_1, ..., a_N)$ of length $N$. He is interested in properties of the sequence $a$.\nFor a nonempty contiguous subsequence $a_l, ..., a_r$ $(1 \\leq l \\leq r \\leq N)$ of the sequence $a$, its _beauty_ is defined as $a_l + ... + a_r$. Niwango-kun wants to know the maximum possible value of the bitwise AND of the beauties of $K$ nonempty contiguous subsequences among all $N(N+1)/2$ nonempty contiguous subsequences. (Subsequences may share elements.)\nFind the maximum possible value for him."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 1000$\n*   $1 \\leq a_i \\leq 10^9$\n*   $1 \\leq K \\leq N(N+1)/2$\n*   All numbers given in input are integers"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $K$\n$a_1$ $a_2$ $...$ $a_N$"},{"iden":"sample input 1","content":"4 2\n2 5 2 5"},{"iden":"sample output 1","content":"12\n\nThere are $10$ nonempty contiguous subsequences of $a$. Let us enumerate them:\n\n*   contiguous subsequences starting from the first element: ${2}, {2, 5}, {2, 5, 2}, {2, 5, 2, 5}$\n*   contiguous subsequences starting from the second element: ${5}, {5, 2}, {5, 2, 5}$\n*   contiguous subsequences starting from the third element: ${2}, {2, 5}$\n*   contiguous subsequences starting from the fourth element: ${5}$\n\n(Note that even if the elements of subsequences are equal, subsequences that have different starting indices are considered to be different.)\nThe maximum possible bitwise AND of the beauties of two different contiguous subsequences is $12$. This can be achieved by choosing ${5, 2, 5}$ (with beauty $12$) and ${2, 5, 2, 5}$ (with beauty $14$)."},{"iden":"sample input 2","content":"8 4\n9 1 8 2 7 5 6 4"},{"iden":"sample output 2","content":"32"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}