n, m = map(int, input().split()) a = list(map(int, input().split())) a.append(0) p = [] flag = False nsum = 0 for i in range(n+1): if a[i] % 2 == 1: flag = True nsum += a[i] else: if flag: p.append(nsum) flag = False nsum = 0 for pi in p: print(pi)