Warm-up candies!! [Very Easy]

3

1 votes
Very-Easy
Problem

Shyamu has a packet in which N candies are there and each candies has a type.More than one candies of same type can be there in a packet. Shyamu has to distribute the candies in his class but he has his own way of distribution.At a time he takes K candies of same type and gives it to a student.He keeps doing this as long as it is possible.In the end you have to count the maximum number of candy of same type (maximum frequency of remaining candies).

NOTE:- If in the end there are two type of candies which have same maximum frequency ,it doesn't matter you only have to tell that frequency.And do not care about number of student in class they are in sufficient number

Standard input
The first line contains two integers N and K.
The second line contains N integers representing the type of ith candy.

Standard output
Output a single integer representing the highest frequency of a candy in the remaining packet.

Constraints
1≤K≤N≤1000
The types of candies are integers between 1 and 1000.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

First Shyamu will take 3 candies of type 4.
then remaining will be..
3 3 4 4 3 3 4 4 3
again he will take 3 candies of type 4 .
3 3 3 3 4 3.
now he can't take the candy of type 4 because its only 1 and minimum we need is 3
now he will take 3 candies of type 3.
then remaining will be..
3 4 3.
now he can't take the candy of type 3 because its only 2 and minimum we need is 3
so at last number of candy type 3 will be maximum which is 2.

Editor Image

?