시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 256 MB 226 70 58 34.940%

문제

정수 수열 a1, a2, ..., an이 있을 때, 1 ≤ i ≤ n − k + 1 인 모든 정수 i에 대해서, ai + ai+1 + ... + ai+k−1 이 짝수라면, 이 수열을 k-짝합 수열이라고 정의한다.

당신은 수열에 있는 몇 개의 원소를 원하는 정수로 바꿀 수 있다. 최소 몇 개의 원소를 바꿔야지 수열을 k-짝합 수열로 만들 수 있는가?

입력

첫 번째 줄에는 정수 n, k가 주어진다. (1 ≤ k ≤ n ≤ 106)

두 번째 줄에는 n개의 정수가 주어진다. 이 중 i 번째 정수는 ai(0 ≤ ai ≤ 109) 를 뜻한다.

출력

바꿔야 하는 원소의 최소 개수를 출력한다.

예제 입력 1

8 3
1 2 3 4 5 6 7 8

예제 출력 1

3
W3sicHJvYmxlbV9pZCI6Ijc5NzYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMyMThcdWM1ZjQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzgxNVx1YzIxOCBcdWMyMThcdWM1ZjQgYTxzdWI+MTxcL3N1Yj4sIGE8c3ViPjI8XC9zdWI+LCAuLi4sIGE8c3ViPm48XC9zdWI+XHVjNzc0IFx1Yzc4OFx1Yzc0NCBcdWI1NGMsIDEgJmxlOyBpICZsZTsgbiAmbWludXM7IGsgKyAxIFx1Yzc3OCBcdWJhYThcdWI0ZTAgXHVjODE1XHVjMjE4IGlcdWM1ZDAgXHViMzAwXHVkNTc0XHVjMTFjLCBhPHN1Yj5pPFwvc3ViPiArIGE8c3ViPmkrMTxcL3N1Yj4gKyAuLi4gKyBhPHN1Yj5pK2smbWludXM7MTxcL3N1Yj4gXHVjNzc0IFx1YzlkZFx1YzIxOFx1Yjc3Y1x1YmE3NCwgXHVjNzc0IFx1YzIxOFx1YzVmNFx1Yzc0NCBrLVx1YzlkZFx1ZDU2OSBcdWMyMThcdWM1ZjRcdWM3NzRcdWI3N2NcdWF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