import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] arr = new int[n]; int count = 0; long sum = 0; StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); if (arr[i] % 2 == 1) { count++; sum += arr[i]; } else { if (count >= m) { sb.append(sum).append("\n"); } count = 0; sum = 0; } } if (count >= m) { sb.append(sum).append("\n"); } System.out.print(sb); } }