Hide

Problem F
Count Doubles

Given an array of $n$ positive integers and an integer $m$, count how many contiguous subarrays of exactly $m$ elements have two or more even values.

For example, given the subarray 1 2 3 4 5 6 7 8 and $m = 3$, the three subarrays 2 3 4, 4 5 6, and 6 7 8 each have at least two even values.

Input

The first line of input consists of the size $1\leq n\leq 10^3$ of the array, followed by $m<n$, the subarray size. Then $n$ positive integers, each at most $10^3$, follow on the second line.

Output

Output how many contiguous subarrays of $m$ elements have at least two even elements.

Sample Input 1 Sample Output 1
8 3
1 2 3 4 5 6 7 8

3

Sample Input 2 Sample Output 2
9 4
1 2 3 5 7 8 9 11 5

0

Please log in to submit a solution to this problem

Log in