import sys
from heapq import heappush, heappop
from operator import itemgetter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, Q = map(int, readline().split())
    work = [0] * N
    for i in range(N):
        s, t, x = map(int, readline().split())
        work[i] = (x, s - x, t - x)
    query = list(map(int, read().split()))

    work.sort(key=itemgetter(1))
    hq = []
    ans = [0] * Q

    idx = 0
    for i, d in enumerate(query):
        while idx < N and work[idx][1] <= d:
            heappush(hq, work[idx])
            idx += 1
        while hq and hq[0][2] <= d:
            heappop(hq)
        if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

    print(*ans, sep='\n')
    return


if __name__ == '__main__':
    main() import sys sys from heapq import heappush, heappop from operator import itemgetter read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 1 << 60 INF 1 << 60 1 60 MOD = 1000000007 MOD 1000000007 def main():
    N, Q = map(int, readline().split())
    work = [0] * N
    for i in range(N):
        s, t, x = map(int, readline().split())
        work[i] = (x, s - x, t - x)
    query = list(map(int, read().split()))

    work.sort(key=itemgetter(1))
    hq = []
    ans = [0] * Q

    idx = 0
    for i, d in enumerate(query):
        while idx < N and work[idx][1] <= d:
            heappush(hq, work[idx])
            idx += 1
        while hq and hq[0][2] <= d:
            heappop(hq)
        if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

    print(*ans, sep='\n')
    return main N, Q = map(int, readline().split()) N map(int, readline().split()) map int readline().split() ().split () readline split Q work = [0] * N work [0] * N [0] 0 N for i in range(N):
        s, t, x = map(int, readline().split())
        work[i] = (x, s - x, t - x)
     i range(N) range N s, t, x = map(int, readline().split()) s map(int, readline().split()) map int readline().split() ().split () readline split t x work[i] = (x, s - x, t - x) work[i] work i (x, s - x, t - x) x s - x s x t - x t x query = list(map(int, read().split())) query list(map(int, read().split())) list map(int, read().split()) map int read().split() ().split () read split work.sort(key=itemgetter(1)) work.sort work sort key=itemgetter(1) key itemgetter(1) itemgetter 1 hq = [] hq [] ans = [0] * Q ans [0] * Q [0] 0 Q idx = 0 idx 0 for i, d in enumerate(query):
        while idx < N and work[idx][1] <= d:
            heappush(hq, work[idx])
            idx += 1
        while hq and hq[0][2] <= d:
            heappop(hq)
        if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

     i d enumerate(query) enumerate query while idx < N and work[idx][1] <= d:
            heappush(hq, work[idx])
            idx += 1
         idx < N and work[idx][1] <= d idx < N idx N work[idx][1] <= d work[idx][1] [idx] work idx 1 d heappush(hq, work[idx]) heappush hq work[idx] work idx idx += 1 idx 1 while hq and hq[0][2] <= d:
            heappop(hq)
         hq and hq[0][2] <= d hq hq[0][2] <= d hq[0][2] [0] hq 0 2 d heappop(hq) heappop hq if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

     not hq hq ans[i] = -1 ans[i] ans i -1 ans[i] = hq[0][0] ans[i] ans i hq[0][0] [0] hq 0 0 print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main readlines = sys.stdin.readlines sys.stdin.readlines readlines def main():
    N, Q = map(int, readline().split())
    work = [0] * N
    for i in range(N):
        s, t, x = map(int, readline().split())
        work[i] = (x, s - x, t - x)
    query = list(map(int, read().split()))

    work.sort(key=itemgetter(1))
    hq = []
    ans = [0] * Q

    idx = 0
    for i, d in enumerate(query):
        while idx < N and work[idx][1] <= d:
            heappush(hq, work[idx])
            idx += 1
        while hq and hq[0][2] <= d:
            heappop(hq)
        if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

    print(*ans, sep='\n')
    return def main():
    N, Q = map(int, readline().split())
    work = [0] * N
    for i in range(N):
        s, t, x = map(int, readline().split())
        work[i] = (x, s - x, t - x)
    query = list(map(int, read().split()))

    work.sort(key=itemgetter(1))
    hq = []
    ans = [0] * Q

    idx = 0
    for i, d in enumerate(query):
        while idx < N and work[idx][1] <= d:
            heappush(hq, work[idx])
            idx += 1
        while hq and hq[0][2] <= d:
            heappop(hq)
        if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

    print(*ans, sep='\n')
    return main read = sys.stdin.read sys.stdin.read read MOD = 1000000007 1000000007 MOD INF = 1 << 60 1 << 60 INF readline = sys.stdin.readline sys.stdin.readline readline
import sys
from heapq import heappush, heappop
from operator import itemgetter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, Q = map(int, readline().split())
    work = [0] * N
    for i in range(N):
        s, t, x = map(int, readline().split())
        work[i] = (x, s - x, t - x)
    query = list(map(int, read().split()))

    work.sort(key=itemgetter(1))
    hq = []
    ans = [0] * Q

    idx = 0
    for i, d in enumerate(query):
        while idx < N and work[idx][1] <= d:
            heappush(hq, work[idx])
            idx += 1
        while hq and hq[0][2] <= d:
            heappop(hq)
        if not hq:
            ans[i] = -1
        else:
            ans[i] = hq[0][0]

    print(*ans, sep='\n')
    return


if __name__ == '__main__':
    main()
