Problem Description

Given a sorted array and q queries, use a function to binary search each query. Print 0-based index or -1.

Input Format

Line1 n q. Line2 n sorted ints. Next q lines x.

Output Format

q lines indices.

Sample Test Case

Input:
5 3 1 3 5 7 9 3 4 9
Output:
1 -1 4

Constraints

n,q

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next