{"raw_statement":[{"iden":"problem statement","content":"Takahashi has $N$ balls. Initially, an integer $A_i$ is written on the $i$\\-th ball.\nHe would like to rewrite the integer on some balls so that there are at most $K$ different integers written on the $N$ balls.\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them."},{"iden":"constraints","content":"*   $1 \\leq K \\leq N \\leq 200000$\n*   $1 \\leq A_i \\leq N$\n*   All input values are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $K$\n$A_1$ $A_2$ ... $A_N$"},{"iden":"sample input 1","content":"5 2\n1 1 2 2 5"},{"iden":"sample output 1","content":"1\n\nFor example, if we rewrite the integer on the fifth ball to $2$, there are two different integers written on the balls: $1$ and $2$. On the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print $1$."},{"iden":"sample input 2","content":"4 4\n1 1 2 2"},{"iden":"sample output 2","content":"0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything."},{"iden":"sample input 3","content":"10 3\n5 1 3 2 4 1 1 2 3 4"},{"iden":"sample output 3","content":"3"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}