1939 - [Croatian2010] Zuma

有一行 N 个弹子,每一个都有一个颜色。每次可以让超过 K 个的连续的同颜色的一段弹子消失,剩下的会重新紧凑在一起。你有无限的所有颜色的弹子,要求在这行弹子中插入最少的弹子,使得弹子全部消失。

输入

The first line of input contains two integers N (1 ≤ N ≤ 100) and K (2 ≤ K ≤ 5) - the number of marbles in the initial sequence and the minimal number of consecutive marbles of the same color he could wish to vanish. The next line contains exactly N integers between 1 and 100 (inclusive), separated by one space. Those numbers represent colors of marbles in the sequence Mirko found.

输出

The output should contain only one line with a single integer number - the minimal number of marbles Mirko has to insert to achive the desired effect.

样例

输入

10 4
3 3 3 3 2 3 1 1 1 3

输出

4
时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题