import sys

from bisect import bisect_left







N,Q = list(map(int, input().split()))

STX = [None] * N

for i in range(N):

  s,t,x = list(map(int, input().split()))

  STX[i] = [x,s,t]

STX.sort()

Dn = [None] * (Q+1)

for i in range(Q):

  Dn[i] = int(eval(input()))

Dn[Q] = 10**10



ans = [-1] * Q

skip = [-1] * Q

for x, s, t in STX:

  ss = bisect_left(Dn, s - x)

  tt = bisect_left(Dn, t - x)

  while ss < tt:

    sk = skip[ss]

    if sk == -1:

      ans[ss] = x

      skip[ss] = tt

      ss += 1

    else:

      ss = sk



print(('\n'.join(map(str, ans))))

# -*- coding: utf-8 -*-

from bisect import bisect_left

from sys import stdin







readl = stdin.readline



## input

N,Q = list(map(int, readl().rstrip().split()))

STX = [list(map(int, readl().rstrip().split())) for _ in range(N)]

Dn = [None for _ in range(Q+1)]

for i in range(Q):

  Dn[i] = int(readl().rstrip())

Dn[Q] = 10**10

ans = [-1] * (Q+1)

skip = [-1] * (Q+1)



for s,t,x in sorted(STX,key=lambda x:x[2]):

  l = bisect_left(Dn,s-x)

  r = bisect_left(Dn,t-x)

  while l < r:

    if skip[l] < 0:

      ans[l] = x

      skip[l] = r

      l += 1

    else:

      l = skip[l]



for d in ans[:-1]:

  print(d)
import sys
from bisect import bisect_left

N, Q = list(map(int, input().split()))
STX = [None] * N
for i in range(N):
    s, t, x = list(map(int, input().split()))
    STX[i] = [x, s, t]
STX.sort()
Dn = [None] * (Q + 1)
for i in range(Q):
    Dn[i] = int(eval(input()))
Dn[Q] = 10**10
ans = [-1] * Q
skip = [-1] * Q
for x, s, t in STX:
    ss = bisect_left(Dn, s - x)
    tt = bisect_left(Dn, t - x)
    while ss < tt:
        sk = skip[ss]
        if sk == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = sk
print(("\n".join(map(str, ans))))

# -*- coding: utf-8 -*-
from bisect import bisect_left
from sys import stdin

readl = stdin.readline
## input
N, Q = list(map(int, readl().rstrip().split()))
STX = [list(map(int, readl().rstrip().split())) for _ in range(N)]
Dn = [None for _ in range(Q + 1)]
for i in range(Q):
    Dn[i] = int(readl().rstrip())
Dn[Q] = 10**10
ans = [-1] * (Q + 1)
skip = [-1] * (Q + 1)
for s, t, x in sorted(STX, key=lambda x: x[2]):
    l = bisect_left(Dn, s - x)
    r = bisect_left(Dn, t - x)
    while l < r:
        if skip[l] < 0:
            ans[l] = x
            skip[l] = r
            l += 1
        else:
            l = skip[l]
for d in ans[:-1]:
    print(d)

-import sys +# -*- coding: utf-8 -*- +from sys import stdin -N, Q = list(map(int, input().split())) -STX = [None] * N -for i in range(N): -    s, t, x = list(map(int, input().split())) -    STX[i] = [x, s, t] -STX.sort() -Dn = [None] * (Q + 1) +readl = stdin.readline +## input +N, Q = list(map(int, readl().rstrip().split())) +STX = [list(map(int, readl().rstrip().split())) for _ in range(N)] +Dn = [None for _ in range(Q + 1)] -    Dn[i] = int(eval(input())) +    Dn[i] = int(readl().rstrip()) -ans = [-1] * Q -skip = [-1] * Q -for x, s, t in STX: -    ss = bisect_left(Dn, s - x) -    tt = bisect_left(Dn, t - x) -    while ss < tt: -        sk = skip[ss] -        if sk == -1: -            ans[ss] = x -            skip[ss] = tt -            ss += 1 +ans = [-1] * (Q + 1) +skip = [-1] * (Q + 1) +for s, t, x in sorted(STX, key=lambda x: x[2]): +    l = bisect_left(Dn, s - x) +    r = bisect_left(Dn, t - x) +    while l < r: +        if skip[l] < 0: +            ans[l] = x +            skip[l] = r +            l += 1 -            ss = sk -print(("\n".join(map(str, ans)))) +            l = skip[l] +for d in ans[:-1]: +    print(d)