n,k = map(int,input().split()) A = list(map(int,input().split())) k -= 1 if A[k]<=0: print(A[k]) else: l,r = k-1, k+1 cl,cr = 0,0 while l>=0: if A[l]!=0 and A[l]%2==0: cl += A[l] elif A[l]%2!=0: cl += A[l] break elif A[l]==0: break l -= 1 while r