Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

K-String

Limits 1s, 512 MB

We will call a string K-String if it consists of K distinct characters. For example, if K is 3 then “abc”, “aabbcc”, “xyaaaa” are K-String whereas “abcd”, “ddhhnnggs” are not.

In one move, you can replace any one character of the given string by any other lower case English alphabet. Your task is to find the minimum number of moves required to make a string K-String.

It is guaranteed that you can always convert the given string into a K-string by performing zero or more moves.

Input

The first line of the input contains two integers N (1 ≤ N ≤ 106), denoting the size of the string and K (1 ≤ K ≤ 26), denoting the number of distinct characters required.

Output

Output the minimum number of moves required to make the given string a K-String.

Samples

InputOutput
4 3
abcd
1
InputOutput
5 3
abcdd
1

Discussion

Statistics


65% Solution Ratio

Double_OEarliest, 6M ago

poisonousFastest, 0.0s

yuv_sustLightest, 131 kB

omar24Shortest, 241B

Submit

Login to submit

Related Contests