import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++) arr[i] = sc.nextInt(); int leftIdx = 0; long sum = 0L; for(int i = 0; i < n; i++) { if(arr[i] % 2 == 1) { sum += arr[i]; } else { if(i - leftIdx >= m) System.out.println(sum); sum = 0L; leftIdx = i + 1; } } if(n - leftIdx >= m) System.out.println(sum); } }