Maximum Distinct Elements After Removing K Elements

easy
1.Given an array containing N elements. 2.The task is to find maximum number of distinct elements after removing K elements from the array. 3.You have to complete the function printMax() to print maximum distinct elements after removing K elements

Input Format

1.First line contains two space separated elements 'N' and 'K'. 2.Second line contains 'N' space separated elements of the array

Output Format

1.Print maximum distinct elements after removing K elements

Constraints

1<=K<=N<=10^6
 1<=A[i]<=10^5

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
7 3
5 7 5 5 1 2 2
Output
4
Previous
Maximum Distance In Arrays
Next
Maximum Number Of Characters Between Any Two Same Characters

Related Questions