After coming back from trick-or-treating, Jayden now has candies that he can eat over the next days.
Jayden's mom allows him to eat as many candies as he wants for days, but on the condition that he does not touch anything sweet for the rest of the year.
Jayden has a severe case of OCD (Obsessive Compulsive Disorder), and he forces himself to perfectly portion his candies, meaning that he will only eat a candy if he can eat the same amount of that brand of candy every day over the days. In order to achieve this, he will even give out some candy to his friends if he can't portion it evenly for the next days.
How many candies will Jayden need to give out?
Constraints
Input Specification
The first line of input will contain two space-separated integers, and .
The next lines of input will contain the brand of the candy (The brand names will all be lowercase characters).
Output Specification
Output one integer, the number of candies that Jayden will need to give away.
Sample Input
10 3
kitkat
kitkat
smarties
kitkat
kitkat
aeros
snickers
smarties
aeros
aeros
Sample Output
4
Sample Output Explanation
Jayden can eat 1 aeros
and 1 kitkat
per day. He will have 1 kitkat
, 2 smarties
, and 1 snickers
left over, which he can't evenly portion over 3 days, so he must give them away.
Comments