403190: GYM101063 H Reporting on Mars

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Reporting on Marstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

A lot of people, still living on Earth, dream of one day getting the opportunity to go to Mars and be a GEMA explorer. It's so glamorous and important, everything is so exciting, so different from the regular boring life on Earth.

However, the reality of the regular folk on Mars is not as nearly glamorous as everyone thinks. A day of an average explorer is at least as boring as a day of any Earth-living human. Every week, GEMA assigns tasks to each explorer in the expedition. Most of the times, these tasks are just very long and detailed reports they have to make. The worst part is that, after completing it, you would still have to review reports from your colleagues and correct them if mistakes are found.

One type of report consists of reporting collected data, but, before making the report, one should verify the consistency of the data. This is obviously the most boring part, so it is not surprising that some people prefer to skip it and just write the report without any verification.

To make matters worse, when reviewing a report containing contradictory data, instead of canceling the report, some explorers choose to manipulate the data, changing some numbers, so it would become consistent. This happens because canceled reports are seen as a great incompetence of the whole team who worked on it.

You are a GEMA explorer and you've just received a report. You need to manipulate the data on it, in order to make it seem correct. The data of the report is a bunch of positive or negative numbers. The data is considered consistent if and only if every sub-array of length k has a positive result when all numbers in it are multiplied together.

Formally, if the report is an array A of N positive and/or negative numbers, the report is consistent, if and only if, for all 1 ≤ i ≤ N - k + 1, we have:

Answer what is the least number of changes you have to make in the report so it would become consistent. A change in the report is changing the value of one of its numbers.

Input

The input begins with two integers N and k (1 ≤ k ≤ N ≤ 5 × 105) in a single line. The next line will contain N integers ai ( - 100 ≤ ai ≤ 100 and ai ≠ 0).

Output

One integer, the answer to the task.

ExamplesInput
3 1
10 -100 33
Output
1
Input
5 5
1 -1 -2 3 4
Output
0
Input
5 3
1 -1 -2 3 4
Output
1

Source/Category

加入题单

算法标签: