N,K=map(int,input().split()) A=list(map(int,input().split())) s=N//K mina=A[K-1] if s==1: print(mina) exit() if K==1: print(sum(A)) exit()