#C4689. Minimal New Items for Unique Collection

    ID: 48254 Type: Default 1000ms 256MiB

Minimal New Items for Unique Collection

Minimal New Items for Unique Collection

In this problem, you are given an integer ( n ) representing the total number of items in Maria's collection, an integer ( k ) representing the desired number of unique items, and a sequence of ( n ) integers that represent the current items in her collection. Your task is to determine the minimum number of additional items that must be added, such that the collection has exactly ( k ) unique items.

Formally, let ( S ) denote the set of unique items in the collection. If ( |S| \geq k ), then the answer is 0, otherwise, the answer is ( k - |S| ).

inputFormat

The input consists of two lines. The first line contains two space-separated integers ( n ) and ( k ). The second line contains ( n ) space-separated integers representing the items in Maria's collection.

outputFormat

Output a single integer representing the minimum number of new items required to achieve exactly ( k ) unique items.## sample

5 3
1 2 2 3 1
0