import numpy as np

N, K = list(map(int, input().split()))

A = list(map(int, input().split()))

Acum = [0]

for a in A:

    Acum.append(Acum[-1] + a)



Apair = []

for i, al in enumerate(Acum):

    for ar in Acum[i + 1:]:

        Apair.append(ar - al)

Apair = np.asarray(Apair, dtype=np.int64)



d = 45  # 10*9*1000 = 1<<40ぐらい

ans = 0

while d >= 0:

    Atmp = np.bitwise_and(np.right_shift(Apair, d), 1)

    if np.count_nonzero(Atmp) >= K:

        ans += 2 ** d

        Apair = Apair[np.nonzero(Atmp)]

    d -= 1



print(ans)

import numpy as np

N, K = list(map(int, input().split()))

A = np.array(input().split(), dtype=np.int64)



Acum = A.cumsum()



Apair = np.subtract.outer(Acum, Acum) + A

Apair = np.tril(Apair).ravel()

Apair = Apair[Apair > 0]



d = 45  # 10*9*1000 = 1<<40ぐらい

ans = 0

while d >= 0:

    Atmp = np.bitwise_and(np.right_shift(Apair, d), 1)

    if np.count_nonzero(Atmp) >= K:

        ans += 2 ** d

        Apair = Apair[np.nonzero(Atmp)]

    d -= 1



print(ans)

import numpy as np

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
Acum = [0]
for a in A:
    Acum.append(Acum[-1] + a)
Apair = []
for i, al in enumerate(Acum):
    for ar in Acum[i + 1 :]:
        Apair.append(ar - al)
Apair = np.asarray(Apair, dtype=np.int64)
d = 45  # 10*9*1000 = 1<<40ぐらい
ans = 0
while d >= 0:
    Atmp = np.bitwise_and(np.right_shift(Apair, d), 1)
    if np.count_nonzero(Atmp) >= K:
        ans += 2**d
        Apair = Apair[np.nonzero(Atmp)]
    d -= 1
print(ans)

import numpy as np

N, K = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.int64)
Acum = A.cumsum()
Apair = np.subtract.outer(Acum, Acum) + A
Apair = np.tril(Apair).ravel()
Apair = Apair[Apair > 0]
d = 45  # 10*9*1000 = 1<<40ぐらい
ans = 0
while d >= 0:
    Atmp = np.bitwise_and(np.right_shift(Apair, d), 1)
    if np.count_nonzero(Atmp) >= K:
        ans += 2**d
        Apair = Apair[np.nonzero(Atmp)]
    d -= 1
print(ans)

-A = list(map(int, input().split())) -Acum = [0] -for a in A: -    Acum.append(Acum[-1] + a) -Apair = [] -for i, al in enumerate(Acum): -    for ar in Acum[i + 1 :]: -        Apair.append(ar - al) -Apair = np.asarray(Apair, dtype=np.int64) +A = np.array(input().split(), dtype=np.int64) +Acum = A.cumsum() +Apair = np.subtract.outer(Acum, Acum) + A +Apair = np.tril(Apair).ravel() +Apair = Apair[Apair > 0]