Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import stdin, stdout
- from bisect import bisect_left
- n, m = map(int, stdin.readline().split())
- h = list(map(int, stdin.readline().split()))
- h.sort()
- t = list(map(int, stdin.readline().split()))
- p = []
- for i in t:
- v = bisect_left(h, i + 1)
- if v <= 0:
- p.append("-1")
- else:
- r = h.pop(v - 1)
- p.append(str(r))
- stdout.write("\n".join(p))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement