import sys
input = sys.stdin.readline
INF = 1<<31
from bisect import bisect_left

def main():
    N,Q = map(int,input().split())
    roadwork = [tuple(map(int,input().split())) for _ in range(N)]
    roadwork.sort(key = lambda x:x[2])
    D = [int(input()) for _ in range(Q)]
    ans = [-1] * Q
    skip = [-1] * Q
    for s,t,x in roadwork:
        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]
    print('\n'.join(map(str,ans)))
if __name__ == '__main__':
    main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline INF = 1<<31 INF 1<<31 1 31 from bisect import bisect_left def main():
    N,Q = map(int,input().split())
    roadwork = [tuple(map(int,input().split())) for _ in range(N)]
    roadwork.sort(key = lambda x:x[2])
    D = [int(input()) for _ in range(Q)]
    ans = [-1] * Q
    skip = [-1] * Q
    for s,t,x in roadwork:
        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]
    print('\n'.join(map(str,ans))) 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 roadwork = [tuple(map(int,input().split())) for _ in range(N)] roadwork [tuple(map(int,input().split())) for _ in range(N)] roadwork.sort(key = lambda x:x[2]) roadwork.sort roadwork 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 roadwork:
        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 roadwork 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 print('\n'.join(map(str,ans))) print '\n'.join(map(str,ans)) '\n'.join '\n' join map(str,ans) map str ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N,Q = map(int,input().split())
    roadwork = [tuple(map(int,input().split())) for _ in range(N)]
    roadwork.sort(key = lambda x:x[2])
    D = [int(input()) for _ in range(Q)]
    ans = [-1] * Q
    skip = [-1] * Q
    for s,t,x in roadwork:
        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]
    print('\n'.join(map(str,ans))) def main():
    N,Q = map(int,input().split())
    roadwork = [tuple(map(int,input().split())) for _ in range(N)]
    roadwork.sort(key = lambda x:x[2])
    D = [int(input()) for _ in range(Q)]
    ans = [-1] * Q
    skip = [-1] * Q
    for s,t,x in roadwork:
        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]
    print('\n'.join(map(str,ans))) main INF = 1<<31 1<<31 INF input = sys.stdin.readline sys.stdin.readline input
import sys
input = sys.stdin.readline
INF = 1<<31
from bisect import bisect_left

def main():
    N,Q = map(int,input().split())
    roadwork = [tuple(map(int,input().split())) for _ in range(N)]
    roadwork.sort(key = lambda x:x[2])
    D = [int(input()) for _ in range(Q)]
    ans = [-1] * Q
    skip = [-1] * Q
    for s,t,x in roadwork:
        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]
    print('\n'.join(map(str,ans)))
if __name__ == '__main__':
    main()