#!/usr/bin/env python3
import sys
from bisect import bisect_left, bisect_right
import heapq

INF = float("inf")


class ErasableHeap(object):
    # https://qiita.com/Salmonize/items/638da118cd621d2628d1
    def __init__(self):
        self.data = []
        self.event = []

    def push(self, x):
        return heapq.heappush(self.data, x)

    def erase(self, x):
        return heapq.heappush(self.event, x)

    def _check(self):
        while self.event and\
                self.data[0] == self.event[0]:
            heapq.heappop(self.data)
            heapq.heappop(self.event)

    def front(self):
        self._check()
        return self.data[0]

    def pop(self):
        self.check()
        return heapq.heappop(self.data)

    def __len__(self):
        self._check()
        return len(self.data)


def main():
    N, Q = map(int, input().split())
    XST = [0]*N
    for i in range(N):
        s, t, x = map(int, input().split())
        XST[i] = (x, s-x, t-x)
    D = [0]*Q
    for i in range(Q):
        D[i] = int(input())
    event = []
    for x, s, t in XST:
        event.append((s, 1, x))
        event.append((t, -1, x))

    event.sort()

    head = 0
    stack = ErasableHeap()
    for t, p, x in event:
        while D[head] < t:
            if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
            head += 1
            if head >= Q:
                return
        if p == 1:
            stack.push(x)
        else:
            stack.erase(x)

    while head < len(D):
        if len(stack) == 0:
            print(-1)
        else:
            print(stack.front())
        head += 1
        if head >= Q:
            return


if __name__ == '__main__':
    main() import sys sys from bisect import bisect_left, bisect_right import heapq heapq INF = float("inf") INF float("inf") float "inf" class ErasableHeap(object):
    # https://qiita.com/Salmonize/items/638da118cd621d2628d1
    def __init__(self):
        self.data = []
        self.event = []

    def push(self, x):
        return heapq.heappush(self.data, x)

    def erase(self, x):
        return heapq.heappush(self.event, x)

    def _check(self):
        while self.event and\
                self.data[0] == self.event[0]:
            heapq.heappop(self.data)
            heapq.heappop(self.event)

    def front(self):
        self._check()
        return self.data[0]

    def pop(self):
        self.check()
        return heapq.heappop(self.data)

    def __len__(self):
        self._check()
        return len(self.data) ErasableHeap def __init__(self):
        self.data = []
        self.event = []

     __init__ self.data = [] self.data self data [] self.event = [] self.event self event [] self self def push(self, x):
        return heapq.heappush(self.data, x)

     push return heapq.heappush(self.data, x) heapq.heappush(self.data, x) heapq.heappush heapq heappush self.data self data x self self x x def erase(self, x):
        return heapq.heappush(self.event, x)

     erase return heapq.heappush(self.event, x) heapq.heappush(self.event, x) heapq.heappush heapq heappush self.event self event x self self x x def _check(self):
        while self.event and\
                self.data[0] == self.event[0]:
            heapq.heappop(self.data)
            heapq.heappop(self.event)

     _check while self.event and\
                self.data[0] == self.event[0]:
            heapq.heappop(self.data)
            heapq.heappop(self.event)

     self.event and\
                self.data[0] == self.event[0] self.event self event self.data[0] == self.event[0] self.data[0] self.data self data 0 self.event[0] self.event self event 0 heapq.heappop(self.data) heapq.heappop heapq heappop self.data self data heapq.heappop(self.event) heapq.heappop heapq heappop self.event self event self self def front(self):
        self._check()
        return self.data[0]

     front self._check() self._check self _check return self.data[0] self.data[0] self.data self data 0 self self def pop(self):
        self.check()
        return heapq.heappop(self.data)

     pop self.check() self.check self check return heapq.heappop(self.data) heapq.heappop(self.data) heapq.heappop heapq heappop self.data self data self self def __len__(self):
        self._check()
        return len(self.data) __len__ self._check() self._check self _check return len(self.data) len(self.data) len self.data self data self self object def main():
    N, Q = map(int, input().split())
    XST = [0]*N
    for i in range(N):
        s, t, x = map(int, input().split())
        XST[i] = (x, s-x, t-x)
    D = [0]*Q
    for i in range(Q):
        D[i] = int(input())
    event = []
    for x, s, t in XST:
        event.append((s, 1, x))
        event.append((t, -1, x))

    event.sort()

    head = 0
    stack = ErasableHeap()
    for t, p, x in event:
        while D[head] < t:
            if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
            head += 1
            if head >= Q:
                return
        if p == 1:
            stack.push(x)
        else:
            stack.erase(x)

    while head < len(D):
        if len(stack) == 0:
            print(-1)
        else:
            print(stack.front())
        head += 1
        if head >= Q:
            return main N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q XST = [0]*N XST [0]*N [0] 0 N for i in range(N):
        s, t, x = map(int, input().split())
        XST[i] = (x, s-x, t-x)
     i range(N) range N s, t, x = map(int, input().split()) s map(int, input().split()) map int input().split() ().split () input split t x XST[i] = (x, s-x, t-x) XST[i] XST i (x, s-x, t-x) x s-x s x t-x t x D = [0]*Q D [0]*Q [0] 0 Q for i in range(Q):
        D[i] = int(input())
     i range(Q) range Q D[i] = int(input()) D[i] D i int(input()) int input() input event = [] event [] for x, s, t in XST:
        event.append((s, 1, x))
        event.append((t, -1, x))

     x s t XST event.append((s, 1, x)) event.append event append (s, 1, x) s 1 x event.append((t, -1, x)) event.append event append (t, -1, x) t -1 x event.sort() event.sort event sort head = 0 head 0 stack = ErasableHeap() stack ErasableHeap() ErasableHeap for t, p, x in event:
        while D[head] < t:
            if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
            head += 1
            if head >= Q:
                return
        if p == 1:
            stack.push(x)
        else:
            stack.erase(x)

     t p x event while D[head] < t:
            if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
            head += 1
            if head >= Q:
                return
         D[head] < t D[head] D head t if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
             len(stack) == 0 len(stack) len stack 0 print(-1) print -1 print(stack.front()) print stack.front() stack.front stack front head += 1 head 1 if head >= Q:
                return
         head >= Q head Q return if p == 1:
            stack.push(x)
        else:
            stack.erase(x)

     p == 1 p 1 stack.push(x) stack.push stack push x stack.erase(x) stack.erase stack erase x while head < len(D):
        if len(stack) == 0:
            print(-1)
        else:
            print(stack.front())
        head += 1
        if head >= Q:
            return head < len(D) head len(D) len D if len(stack) == 0:
            print(-1)
        else:
            print(stack.front())
         len(stack) == 0 len(stack) len stack 0 print(-1) print -1 print(stack.front()) print stack.front() stack.front stack front head += 1 head 1 if head >= Q:
            return head >= Q head Q return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main class ErasableHeap(object):
    # https://qiita.com/Salmonize/items/638da118cd621d2628d1
    def __init__(self):
        self.data = []
        self.event = []

    def push(self, x):
        return heapq.heappush(self.data, x)

    def erase(self, x):
        return heapq.heappush(self.event, x)

    def _check(self):
        while self.event and\
                self.data[0] == self.event[0]:
            heapq.heappop(self.data)
            heapq.heappop(self.event)

    def front(self):
        self._check()
        return self.data[0]

    def pop(self):
        self.check()
        return heapq.heappop(self.data)

    def __len__(self):
        self._check()
        return len(self.data) class ErasableHeap(object):
    # https://qiita.com/Salmonize/items/638da118cd621d2628d1
    def __init__(self):
        self.data = []
        self.event = []

    def push(self, x):
        return heapq.heappush(self.data, x)

    def erase(self, x):
        return heapq.heappush(self.event, x)

    def _check(self):
        while self.event and\
                self.data[0] == self.event[0]:
            heapq.heappop(self.data)
            heapq.heappop(self.event)

    def front(self):
        self._check()
        return self.data[0]

    def pop(self):
        self.check()
        return heapq.heappop(self.data)

    def __len__(self):
        self._check()
        return len(self.data) ErasableHeap def main():
    N, Q = map(int, input().split())
    XST = [0]*N
    for i in range(N):
        s, t, x = map(int, input().split())
        XST[i] = (x, s-x, t-x)
    D = [0]*Q
    for i in range(Q):
        D[i] = int(input())
    event = []
    for x, s, t in XST:
        event.append((s, 1, x))
        event.append((t, -1, x))

    event.sort()

    head = 0
    stack = ErasableHeap()
    for t, p, x in event:
        while D[head] < t:
            if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
            head += 1
            if head >= Q:
                return
        if p == 1:
            stack.push(x)
        else:
            stack.erase(x)

    while head < len(D):
        if len(stack) == 0:
            print(-1)
        else:
            print(stack.front())
        head += 1
        if head >= Q:
            return def main():
    N, Q = map(int, input().split())
    XST = [0]*N
    for i in range(N):
        s, t, x = map(int, input().split())
        XST[i] = (x, s-x, t-x)
    D = [0]*Q
    for i in range(Q):
        D[i] = int(input())
    event = []
    for x, s, t in XST:
        event.append((s, 1, x))
        event.append((t, -1, x))

    event.sort()

    head = 0
    stack = ErasableHeap()
    for t, p, x in event:
        while D[head] < t:
            if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
            head += 1
            if head >= Q:
                return
        if p == 1:
            stack.push(x)
        else:
            stack.erase(x)

    while head < len(D):
        if len(stack) == 0:
            print(-1)
        else:
            print(stack.front())
        head += 1
        if head >= Q:
            return main INF = float("inf") float("inf") INF
#!/usr/bin/env python3
import sys
from bisect import bisect_left, bisect_right
import heapq

INF = float("inf")


class ErasableHeap(object):
    # https://qiita.com/Salmonize/items/638da118cd621d2628d1
    def __init__(self):
        self.data = []
        self.event = []

    def push(self, x):
        return heapq.heappush(self.data, x)

    def erase(self, x):
        return heapq.heappush(self.event, x)

    def _check(self):
        while self.event and\
                self.data[0] == self.event[0]:
            heapq.heappop(self.data)
            heapq.heappop(self.event)

    def front(self):
        self._check()
        return self.data[0]

    def pop(self):
        self.check()
        return heapq.heappop(self.data)

    def __len__(self):
        self._check()
        return len(self.data)


def main():
    N, Q = map(int, input().split())
    XST = [0]*N
    for i in range(N):
        s, t, x = map(int, input().split())
        XST[i] = (x, s-x, t-x)
    D = [0]*Q
    for i in range(Q):
        D[i] = int(input())
    event = []
    for x, s, t in XST:
        event.append((s, 1, x))
        event.append((t, -1, x))

    event.sort()

    head = 0
    stack = ErasableHeap()
    for t, p, x in event:
        while D[head] < t:
            if len(stack) == 0:
                print(-1)
            else:
                print(stack.front())
            head += 1
            if head >= Q:
                return
        if p == 1:
            stack.push(x)
        else:
            stack.erase(x)

    while head < len(D):
        if len(stack) == 0:
            print(-1)
        else:
            print(stack.front())
        head += 1
        if head >= Q:
            return


if __name__ == '__main__':
    main()
