from bisect import bisect_left
def main():
    N, Q = map(int, input().split())
    W = [tuple(map(int, input().split())) for _ in range(N)]
    W.sort(key=lambda x:x[2])
    
    D = [int(input()) for _ in range(Q)]
    ans = [-1]*Q
    skip = [-1]*Q
    for s, t, x in W:
        l = bisect_left(D, s-x)
        r = bisect_left(D, t-x)
        while l < r:
            if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
    for a in ans:
        print(a)
main()   from bisect import bisect_left def main():
    N, Q = map(int, input().split())
    W = [tuple(map(int, input().split())) for _ in range(N)]
    W.sort(key=lambda x:x[2])
    
    D = [int(input()) for _ in range(Q)]
    ans = [-1]*Q
    skip = [-1]*Q
    for s, t, x in W:
        l = bisect_left(D, s-x)
        r = bisect_left(D, t-x)
        while l < r:
            if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
    for a in ans:
        print(a) main N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q tuple(map(int, input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split W = [tuple(map(int, input().split())) for _ in range(N)] W [tuple(map(int, input().split())) for _ in range(N)] W.sort(key=lambda x:x[2]) W.sort W sort key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x 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)] ans = [-1]*Q ans [-1]*Q [-1] -1 Q skip = [-1]*Q skip [-1]*Q [-1] -1 Q for s, t, x in W:
        l = bisect_left(D, s-x)
        r = bisect_left(D, t-x)
        while l < r:
            if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
     s t x W 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 while l < r:
            if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
     l < r l r if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
     skip[l] == -1 skip[l] skip l -1 ans[l] = x ans[l] ans l x skip[l] = r skip[l] skip l r l+=1 l 1 l = skip[l] l skip[l] skip l for a in ans:
        print(a) a ans print(a) print a main() main def main():
    N, Q = map(int, input().split())
    W = [tuple(map(int, input().split())) for _ in range(N)]
    W.sort(key=lambda x:x[2])
    
    D = [int(input()) for _ in range(Q)]
    ans = [-1]*Q
    skip = [-1]*Q
    for s, t, x in W:
        l = bisect_left(D, s-x)
        r = bisect_left(D, t-x)
        while l < r:
            if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
    for a in ans:
        print(a) def main():
    N, Q = map(int, input().split())
    W = [tuple(map(int, input().split())) for _ in range(N)]
    W.sort(key=lambda x:x[2])
    
    D = [int(input()) for _ in range(Q)]
    ans = [-1]*Q
    skip = [-1]*Q
    for s, t, x in W:
        l = bisect_left(D, s-x)
        r = bisect_left(D, t-x)
        while l < r:
            if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
    for a in ans:
        print(a) main
from bisect import bisect_left
def main():
    N, Q = map(int, input().split())
    W = [tuple(map(int, input().split())) for _ in range(N)]
    W.sort(key=lambda x:x[2])
    
    D = [int(input()) for _ in range(Q)]
    ans = [-1]*Q
    skip = [-1]*Q
    for s, t, x in W:
        l = bisect_left(D, s-x)
        r = bisect_left(D, t-x)
        while l < r:
            if skip[l] == -1:
                ans[l] = x
                skip[l] = r
                l+=1
            else:
                l = skip[l]
    for a in ans:
        print(a)
main()  