Find unique element
Submissions: 2160   Accuracy:

48.56%

  Difficulty: Basic   Marks: 1

Given an array which contains all elements occurring k times, but one occurs only once. Find that unique element.

Input:
The first line consists of an integer T i.e number of test cases. The first line of each test case consists of two integers n and k. The next line consists of n spaced integers. 

Output:
Print the required output.

Constraints: 
1<=T<=100
2<=k<n<=100
1<=a[i]<=10000

Example:
Input:

2
7 3
6 2 5 2 2 6 6 
5 4
2 2 2 10 2

Output:
5
10

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Ashtputre
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.