eolymp
bolt
Try our new interface for solving problems
Problems

SpaceX

SpaceX

Elon Musk plans to send his spaceships to $k$ different planets. To do this, he has $n$ spaceships. Initially, it is known where each ship will be sent. The planets are numbered from $1$ to $10^9$. As SpaceX’s chief space engineer, you are entitled to change the destination of any ship. For the minimum number of changes you need to make sure that all ships are sent to $k$ different planets. \InputFile The first line contains two numbers $n~(1 \le n \le 10^5)$ and $k~(1 \le k \le n)$. Second line contains $n$ integers $p_i~(1 \le p_i \le 10^5)$ --- the original ship destinations. \OutputFile Print the minimum number of changes.
Time limit 1 second
Memory limit 128 MiB
Input example #1
3 1
1 5 3
Output example #1
2
Input example #2
5 4
10 1 2 1 10
Output example #2
1
Author Rafael Sadatimov
Source 2019-2020 Azerbaijan Finals, June 17