A = input().split() B = input().split() C = 0 D = 0 for x in range(int(A[0])): if 1 == int(B[x]) % 2: C = C + int(B[x]) D = D + 1 else: if C != 0: if D >= int(A[1]): print(C) C = 0 D = 0 if D >= int(A[1]): print(C)