#P3156. 【深基15.例1】询问学号

【深基15.例1】询问学号

Problem Description

There are n(n2×106)n(n \le 2 \times 10^6) students entering the classroom one after another. We know each student’s ID number (between 11 and 10910^9), given in the order they enter the classroom. Class starts, and the teacher wants to know what the ID number of the ii-th student who entered the classroom is (the first student to enter has i=1i=1). The number of queries does not exceed 10510^5.

Input Format

The first line contains 22 integers nn and mm, representing the number of students and the number of queries.

The second line contains nn integers, representing the ID numbers in the order they enter the classroom.

The third line contains mm integers, representing queries asking for which student (by entry order) to check.

Output Format

Output mm integers as the answers, separated by newlines.

10 3
1 9 2 60 8 17 11 4 5 14
1 5 9

1
8
5

Hint

Translated by ChatGPT 5