{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"### Read problems statements in [Mandarin Chinese](https://www.codechef.com/download/translated/COOK128/mandarin/CM164364.pdf), [Russian](https://www.codechef.com/download/translated/COOK128/russian/CM164364.pdf), and [Bengali](https://www.codechef.com/download/translated/COOK128/bengali/CM164364.pdf) as well.\n\nThere are $n$ chocolates, and you are given an array of $n$ numbers where the $i$-th number $A_i$ is the flavour type of the $i$-th chocolate. Sebrina wants to eat as many different types of chocolates as possible, but she also has to save at least $x$ number of chocolates for her little brother. \n\nFind the maximum possible number of distinct flavour types Sebrina can have.\n"}},{"title":"Input Format","value":{"format":"MD","content":"The first line contains an integer $T$ --- the number of test cases.\n- The first line of each test case consists of two integers $n$, $x$ - The number of chocolates Sabrina has and the number of chocolates she has to save for her brother, respectively.\n- The second line contains $n$ integers $A_1,\\ldots, A_n$, where the $i$-th chocolate has type $A_i$.\n"}},{"title":"Output Format","value":{"format":"MD","content":"For each test case, output a single integer denoting the maximum possible number of distinct chocolate flavours Sabrina can eat.\n"}},{"title":"Constraints","value":{"format":"MD","content":"- $1\\le T\\le 10$\n- $1 \\le x \\le n \\le 2 \\cdot 10^5 $ \n- $1 \\le A_{i} \\le 10^9$\n- Sum of $n$ over all test cases do not exceed $ 2 \\cdot 10^5 $"}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n2 1\r\n1 2\r\n4 2\r\n1 1 1 1\r\n5 3\r\n50 50 50 100 100\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n1\r\n2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n**Test case $1$:** In the first case, the maximum number of chocolates Sebrina can have is $1$ as she has to leave $1$ chocolate for her brother. Thus, the maximum number of distinct chocolates is also $1$.\n\n**Test case $2$:** Sebrina has to leave $2$ chocolates for her brother. She can eat any $2$ chocolates. Since all the chocolates have the same flavor, it does not matter which chocolates she eats. The maximum number of distinct chocolates would be $1$.\n\n**Test case $3$:** Sebrina needs to save $3$ chocolates for her brother. She can eat any $2$ chocolates. To maximize the number of distinct chocolates, she can eat chocolates $1$ and $5$ with flavors $50$ and $100$ respectively. Thus maximum number of distinct chocolates is $2$."}}]}