n,m=[int(j) for j in input().split()] a=[int(j) for j in input().split()] cnt=0 tmp=0 for i in a: if i%2==1: cnt+=1 tmp+=i else: if cnt>=m: print(tmp) cnt=0 tmp=0 if cnt>=m: print(tmp)