Linear Search

5

2 votes
Very-Easy
Problem

You are given an array A of size N. You are given number K which you have to search in the array and return the index of that element. If there are multiple matches then tell the index of the first matched element. If there is no match, print -1.

Input

First line of input contains two value ,N and K, where N is the size of the array and K is the key to be searched. Next N lines consist elements of array as shown in sample input

Output

Print the index of first appearance of element (if found) else -1.

Constraints

1 ≤ N ≤ 100000

0 ≤ A[i] ≤ 10^9

'long int' is used for storing number in the range of 10^9

Sample Input
5 66
11
33
55
66
77
Sample Output
3
Time Limit: 1
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?