using System; using System.Collections.Generic; using System.Linq; using static System.Console; class Program { static void Main() { var NM = ReadLine().Split(); var N = int.Parse(NM[0]); var M = int.Parse(NM[1]); var A = (ReadLine()).Split().Select(int.Parse).ToArray(); var sum = new long[N + 1]; for (int i = 0; i < N; i++) { sum[i + 1] = sum[i] + A[i]; } var t = 0; var p = false; for (int s = 0; s < N; s++) { if (A[s] % 2 == 1) { if (p) { p = true; } else { t = s; p = true; } } else { if (p) { if (s - t + 1 >= M) WriteLine(sum[s] - sum[t]); t = s; p = false; } else { t = s; p = false; } } } if(p) if (N - t >= M) WriteLine(sum[N] - sum[t]); } }