n, m = map(int, input().split()) cnt = 0 for a in list(map(int, input().split())) + [0]: if a & 1: cnt += a elif cnt != 0: print(cnt) cnt = 0