AT_awc0002_a 本棚の整理
Description
Takahashi works at a library. On a bookshelf in the library, $ N $ books are lined up in a row, and each book has a catalog number assigned to it. The catalog number of the $ i $ -th book from the left ( $ 1 \leq i \leq N $ ) is $ A_i $ . Note that different books may have the same catalog number.
Aoki asks, "I'm looking for the book with catalog number $ K $ . Where is it?"
Among the $ N $ books on the bookshelf, find the book whose catalog number is exactly $ K $ . If a book with catalog number $ K $ exists, output the smallest position of such a book (counted from the left, 1-indexed). If no such book exists, output $ -1 $ .
Input Format
> $ N $ $ K $ $ A_1 $ $ A_2 $ $ \ldots $ $ A_N $
- The first line contains an integer $ N $ representing the number of books and an integer $ K $ representing the catalog number being searched for, separated by a space.
- The second line contains integers $ A_1, A_2, \ldots, A_N $ representing the catalog numbers of the books, separated by spaces.
Output Format
If a book with catalog number exactly $ K $ exists, output on a single line the smallest position of such a book (counted from the left, 1-indexed). If no such book exists, output $ -1 $ .
Explanation/Hint
### Constraints
- $ 1 \leq N \leq 2 \times 10^5 $
- $ 1 \leq K \leq 10^9 $
- $ 1 \leq A_i \leq 10^9 $ $ (1 \leq i \leq N) $
- All inputs are integers