Given an array of N elements and a integer K. Your task is to return the position of first occurence of K in the given array.
Note: Position of first element is considered as 1.
First line of input contains T denoting the number of testcases. For each testcase there will be two space separated integer N and K denoting the size of array and the value of K respectively. The next line contains the N space separated integers denoting the elements of array.
For each test case, print the index of first occurrence of given number K. Print -1 if the number is not found in array.
1 <= T <= 100
1 <= N <= 106
1 <= K <= 106
1 <= A[i] <= 106
9 7 2 16 4
1 22 57 47 34 18 66
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.