#CCBCHBAHAI0000155. Tìm vị trí xuất hiện đầu tiên của x (First Position of x)
Tìm vị trí xuất hiện đầu tiên của x (First Position of x)
First Position of x
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer array and an integer , find the smallest -based index such that .
If no such index exists, print -1.
Input
- The first line contains integers and .
- The second line contains integers .
Output
Print the first index of , or -1 if does not occur.
Subtasks
Subtask 1 (100 points): ; .
Examples
Input
7 5
2 5 3 5 8 5 1
Output
1
Explanation
Value occurs at indices . The smallest is .