kex
면접 대비시간 제한2초메모리 제한1024 MB
서로 다른 음이 아닌 정수 n개로 이루어진 집합과 q개의 k가 주어질 때, 집합에 없는 음이 아닌 정수 중 k번째로 작은 값을 구한다.
문제
Consider the set of non-negative integers . The minimum non-negative integer that does not occur in this set is considered, for example, in game theory, and is denoted as . For example, .
Ann has decided to generalize the concept of mex. Consider a positive integer and a set of non-negative integer . Denote as a non-negative integer that is -th in ascending order among all integers that are not in . For example, .
You must find for the given set of integers and values of .
입력
The first line of input contains two integers and () --- number of elements in and number of numbers, that you have to find.
In second line of input contains different not negative integers, each of which is at most , --- elements of .
In third line of input contains integers ().
출력
Print values: .