Introduction - If you have any usage issues, please Google them yourself
Have an adaptive single linked list. This list can only start from the front one-way in order to find a complete set of elements each element to find a list after it raised to the forefront, to maintain the relative relationship between the other elements remain unchanged. Now stored with the list and look for positive integers: given some unknown positive integer, if the search process to find the output number of elements visited, if not found, output-1.
Input The first line contains two integers n, m, that is, the number of elements in the list and find the number of times. The second line contains n positive integers, starting from the front of the list given by the order of the elements of the list. These elements ensure the pairwise equal. The following m lines each line contains a positive integer c, represents an unknown element.