01204212/resistors

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
This is part of 01204212

You want to buy a resistor. The shop has a lot of resistors available. If you want a resister with the resistance of r ohm, you are usually fine with having a resister with the resistance higher than r ohm.

There are 2 versions of the task.

Resistor 1: Unlimited supply

There are n types of resistors in the shop. Type i resistors have the resistance of ri ohm.

You get m' requests, each request specifies the expected resistance x. You want to answer with the smallest resistance ri available at the shop which is at least as large as x. If every resistor at the shop has resistance less than x, you should output -1.

Input/output

Input

  • First line: two integers n and m (1<=n<=100,000; 1<=m<=100,000)
  • Next n lines: line 1+i contains resistance ri. It is guaranteed that the values are increasing ri < ri+1, for 1<=i<n.
  • Next m lines: line 1+n+j specifies the j-th request as an integer x.

Output

The output contains m lines. Each line specifies the smallest resistance ri available at the shop which is at least as large as x. If every resistor at the shop has resistance less than x, you should output -1.

Example

Input

5 5
10
20
30
50
100
9
15
30
101
21

Output

10
20
30
-1
30

Test data

Code

Resistor 2: Limited supply