import sequtils, strutils let read* = iterator: string = while true: (for s in stdin.readLine.split: yield s) template input*(T: static[typedesc]): untyped = when T is int: read().parseInt elif T is float: read().parseFloat elif T is string: read() elif T is char: read()[0] let N, M = input(int) let A = newSeqWith(N, input(int)) & @[0] var res = newSeq[int]() var cnt, sum = 0 for a in A: if (a and 1) == 1: inc cnt; sum += a else: if cnt >= M: res.add(sum) cnt = 0; sum = 0 echo res.join("\n")