def e_roadwork(N, Q, Construction, D):
    from bisect import bisect_left
    from operator import itemgetter
    ans = [-1] * Q
    skip = [-1] * Q

    Construction.sort(key=itemgetter(2))

    for s, t, x in Construction:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        t = l
        while t < r:
            if skip[t] == -1:
                ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
                skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
                t += 1
            else:
                t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
    return ' '.join(map(str, ans))
    # 参考: https://atcoder.jp/contests/abc128/submissions/5654623

N, Q = [int(i) for i in input().split()]
Construction = [tuple(int(i) for i in input().split()) for j in range(N)]
D = [int(input()) for _ in range(Q)]
print(e_roadwork(N, Q, Construction, D)) def e_roadwork(N, Q, Construction, D):
    from bisect import bisect_left
    from operator import itemgetter
    ans = [-1] * Q
    skip = [-1] * Q

    Construction.sort(key=itemgetter(2))

    for s, t, x in Construction:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        t = l
        while t < r:
            if skip[t] == -1:
                ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
                skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
                t += 1
            else:
                t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
    return ' '.join(map(str, ans))
    # 参考: https://atcoder.jp/contests/abc128/submissions/5654623 e_roadwork from bisect import bisect_left from operator import itemgetter ans = [-1] * Q ans [-1] * Q [-1] -1 Q skip = [-1] * Q skip [-1] * Q [-1] -1 Q Construction.sort(key=itemgetter(2)) Construction.sort Construction sort key=itemgetter(2) key itemgetter(2) itemgetter 2 for s, t, x in Construction:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        t = l
        while t < r:
            if skip[t] == -1:
                ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
                skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
                t += 1
            else:
                t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
     s t x Construction l = bisect_left(D, s - x) l bisect_left(D, s - x) bisect_left D s - x s x r = bisect_left(D, t - x) r bisect_left(D, t - x) bisect_left D t - x t x t = l t l while t < r:
            if skip[t] == -1:
                ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
                skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
                t += 1
            else:
                t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
     t < r t r if skip[t] == -1:
                ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
                skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
                t += 1
            else:
                t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
     skip[t] == -1 skip[t] skip t -1 ans[t] = x ans[t] ans t x skip[t] = r skip[t] skip t r t += 1 t 1 t = skip[t] t skip[t] skip t return ' '.join(map(str, ans)) ' '.join(map(str, ans)) ' '.join ' ' join map(str, ans) map str ans N N Q Q Construction Construction D D int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i N, Q = [int(i) for i in input().split()] N [int(i) for i in input().split()] Q tuple(int(i) for i in input().split()) for j in range(N) for j in range(N) j range(N) range N for j in range(N) tuple(int(i) for i in input().split()) tuple int(i) int i Construction = [tuple(int(i) for i in input().split()) for j in range(N)] Construction [tuple(int(i) for i in input().split()) for j in range(N)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input D = [int(input()) for _ in range(Q)] D [int(input()) for _ in range(Q)] print(e_roadwork(N, Q, Construction, D)) print e_roadwork(N, Q, Construction, D) e_roadwork N Q Construction D def e_roadwork(N, Q, Construction, D):
    from bisect import bisect_left
    from operator import itemgetter
    ans = [-1] * Q
    skip = [-1] * Q

    Construction.sort(key=itemgetter(2))

    for s, t, x in Construction:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        t = l
        while t < r:
            if skip[t] == -1:
                ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
                skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
                t += 1
            else:
                t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
    return ' '.join(map(str, ans))
    # 参考: https://atcoder.jp/contests/abc128/submissions/5654623 def e_roadwork(N, Q, Construction, D):
    from bisect import bisect_left
    from operator import itemgetter
    ans = [-1] * Q
    skip = [-1] * Q

    Construction.sort(key=itemgetter(2))

    for s, t, x in Construction:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        t = l
        while t < r:
            if skip[t] == -1:
                ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
                skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
                t += 1
            else:
                t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
    return ' '.join(map(str, ans))
    # 参考: https://atcoder.jp/contests/abc128/submissions/5654623 e_roadwork Construction = [tuple(int(i) for i in input().split()) for j in range(N)] [tuple(int(i) for i in input().split()) for j in range(N)] Construction D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D N, Q = [int(i) for i in input().split()] [int(i) for i in input().split()] N Q = [int(i) for i in input().split()] [int(i) for i in input().split()] Q
def e_roadwork(N, Q, Construction, D):
    from bisect import bisect_left
    from operator import itemgetter
    ans = [-1] * Q
    skip = [-1] * Q

    Construction.sort(key=itemgetter(2))

    for s, t, x in Construction:
        l = bisect_left(D, s - x)
        r = bisect_left(D, t - x)
        t = l
        while t < r:
            if skip[t] == -1:
                ans[t] = x  # lからr-1の時刻に出発した人は座標xの工事に引っかかる
                skip[t] = r  # lからr-1の時刻に出発した人はもう調べないようにする
                t += 1
            else:
                t = skip[t]  # tが指定する人はもう調べ終わっているので飛ばす
    return ' '.join(map(str, ans))
    # 参考: https://atcoder.jp/contests/abc128/submissions/5654623

N, Q = [int(i) for i in input().split()]
Construction = [tuple(int(i) for i in input().split()) for j in range(N)]
D = [int(input()) for _ in range(Q)]
print(e_roadwork(N, Q, Construction, D))