跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F1523. Lottery

    ID: 1529 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>待分类整理状态难度待定难度共享题库Codeforces英文题面题目来源题面语言

Lottery

题目描述

I. Lottery
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Today Berland holds a lottery with a prize− a huge sum of money! There are k persons, who attend the lottery. Each of them will receive a unique integer from 1 to k.

The organizers bought n balls to organize the lottery, each of them is painted some color, the colors are numbered from 1 to k. A ball of color c corresponds to the participant with the same number. The organizers will randomly choose one ball − and the winner will be the person whose color will be chosen!

Five hours before the start of the lottery the organizers realized that for the lottery to be fair there must be an equal number of balls of each of k colors. This will ensure that the chances of winning are equal for all the participants.

You have to find the minimum number of balls that you need to repaint to make the lottery fair. A ball can be repainted to any of the k colors.

Input

The first line of the input contains two integers n and k (1≤kn≤100)− the number of balls and the number of participants. It is guaranteed that n is evenly divisible by k.

The second line of the input contains space-separated sequence of n positive integers ci (1≤cik), where ci means the original color of the i-th ball.

Output

In the single line of the output print a single integer− the minimum number of balls to repaint to make number of balls of each color equal.

Examples
Input
4 2
2 1 2 2
Output
1
Input
8 4
1 2 1 1 1 4 1 4
Output
3
Note

In the first example the organizers need to repaint any ball of color 2 to the color 1.

In the second example the organizers need to repaint one ball of color 1 to the color 2 and two balls of the color 1 to the color 3.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 1038 题。保留原作者与原赛事署名。