{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"Given an array, your task is to find the k-th occurrence (from left to right) of an integer v. To make the problem more difficult (and interesting!), you’ll have to answer m such queries.\n\nInput\nThere are several test cases. The first line of each test case contains two integers n, m (1 ≤ n, m ≤ 100, 000), the number of elements in the array, and the number of queries. The next line contains n positive integers not larger than 1,000,000. Each of the following m lines contains two integer k and v (1 ≤ k ≤ n, 1 ≤ v ≤ 1, 000, 000). The input is terminated by end-of-file (EOF).\n\nOutput\nFor each query, print the 1-based location of the occurrence. If there is no such element, output ‘0’ instead.\n\nSample Input\n8 4\n1 3 2 2 4 3 2 1\n1 3\n2 4\n3 2\n4 2\n\nSample Output\n2\n0\n7\n0\n"}}]}