import heapq
class HeapDict:
    def __init__(self):
        self.h = []
        self.d = {}

    def insert(self,x):
        if x not in self.d or self.d[x] == 0:
            heapq.heappush(self.h, x)
        self.d.setdefault(x,0)
        self.d[x] += 1


    def erase(self,x):
        if x not in self.d or self.d[x] == 0:
            return
        else:
            self.d[x] -= 1

        while self.h:
            if self.d[self.h[0]] == 0:
                heapq.heappop(self.h)
            else:
                break


    def get_min(self):
        if not self.h:
            return None
        else:
            return self.h[0]


    def pop(self):
        poped_val = self.h[0]
        self.erase(poped_val)
        return poped_val


    def exist(self, x):
        return (x in self.d and self.d[x] > 0)


    def show_h(self):
        elems = [v for v in self.h if self.d[v] > 0]
        print(elems)


    def show_d(self):
        print(self.d)



def main():
    n,q = map(int, input().split())
    eventl = []

    for _ in range(n):
        s,t,x = map(int, input().split())
        eventl.append((s-x, 'a-stop', x)) 
        eventl.append((t-x, 'b-start', x))

    for i in range(q):
        d = int(input())
        eventl.append((d,'c-go', i))

    eventl.sort()

    ans = [0]*q
    hd = HeapDict()
    for e in eventl:
        if e[1] == 'a-stop':
            hd.insert(e[2])
        elif e[1] == 'b-start':
            hd.erase(e[2])
        else:
            min_x = hd.get_min()
            if min_x is not None:
                ans[e[2]] = min_x
            else:
                ans[e[2]] = -1

    for a in ans:
        print(a)


if __name__ == "__main__":
    main() import heapq heapq class HeapDict:
    def __init__(self):
        self.h = []
        self.d = {}

    def insert(self,x):
        if x not in self.d or self.d[x] == 0:
            heapq.heappush(self.h, x)
        self.d.setdefault(x,0)
        self.d[x] += 1


    def erase(self,x):
        if x not in self.d or self.d[x] == 0:
            return
        else:
            self.d[x] -= 1

        while self.h:
            if self.d[self.h[0]] == 0:
                heapq.heappop(self.h)
            else:
                break


    def get_min(self):
        if not self.h:
            return None
        else:
            return self.h[0]


    def pop(self):
        poped_val = self.h[0]
        self.erase(poped_val)
        return poped_val


    def exist(self, x):
        return (x in self.d and self.d[x] > 0)


    def show_h(self):
        elems = [v for v in self.h if self.d[v] > 0]
        print(elems)


    def show_d(self):
        print(self.d) HeapDict def __init__(self):
        self.h = []
        self.d = {}

     __init__ self.h = [] self.h self h [] self.d = {} self.d self d {} self self def insert(self,x):
        if x not in self.d or self.d[x] == 0:
            heapq.heappush(self.h, x)
        self.d.setdefault(x,0)
        self.d[x] += 1


     insert if x not in self.d or self.d[x] == 0:
            heapq.heappush(self.h, x)
         x not in self.d or self.d[x] == 0 x not in self.d x self.d self d self.d[x] == 0 self.d[x] self.d self d x 0 heapq.heappush(self.h, x) heapq.heappush heapq heappush self.h self h x self.d.setdefault(x,0) self.d.setdefault self.d self d setdefault x 0 self.d[x] += 1 self.d[x] self.d self d x 1 self self x x def erase(self,x):
        if x not in self.d or self.d[x] == 0:
            return
        else:
            self.d[x] -= 1

        while self.h:
            if self.d[self.h[0]] == 0:
                heapq.heappop(self.h)
            else:
                break


     erase if x not in self.d or self.d[x] == 0:
            return
        else:
            self.d[x] -= 1

         x not in self.d or self.d[x] == 0 x not in self.d x self.d self d self.d[x] == 0 self.d[x] self.d self d x 0 return self.d[x] -= 1 self.d[x] self.d self d x 1 while self.h:
            if self.d[self.h[0]] == 0:
                heapq.heappop(self.h)
            else:
                break


     self.h self h if self.d[self.h[0]] == 0:
                heapq.heappop(self.h)
            else:
                break


     self.d[self.h[0]] == 0 self.d[self.h[0]] self.d self d self.h[0] self.h self h 0 0 heapq.heappop(self.h) heapq.heappop heapq heappop self.h self h break self self x x def get_min(self):
        if not self.h:
            return None
        else:
            return self.h[0]


     get_min if not self.h:
            return None
        else:
            return self.h[0]


     not self.h self.h self h return None None return self.h[0] self.h[0] self.h self h 0 self self def pop(self):
        poped_val = self.h[0]
        self.erase(poped_val)
        return poped_val


     pop poped_val = self.h[0] poped_val self.h[0] self.h self h 0 self.erase(poped_val) self.erase self erase poped_val return poped_val poped_val self self def exist(self, x):
        return (x in self.d and self.d[x] > 0)


     exist return (x in self.d and self.d[x] > 0) x in self.d and self.d[x] > 0 x in self.d x self.d self d self.d[x] > 0 self.d[x] self.d self d x 0 self self x x def show_h(self):
        elems = [v for v in self.h if self.d[v] > 0]
        print(elems)


     show_h v for v in self.h if self.d[v] > 0 for v in self.h if self.d[v] > 0 v self.h self h self.d[v] > 0 self.d[v] self.d self d v 0 if self.d[v] > 0 v elems = [v for v in self.h if self.d[v] > 0] elems [v for v in self.h if self.d[v] > 0] print(elems) print elems self self def show_d(self):
        print(self.d) show_d print(self.d) print self.d self d self self def main():
    n,q = map(int, input().split())
    eventl = []

    for _ in range(n):
        s,t,x = map(int, input().split())
        eventl.append((s-x, 'a-stop', x)) 
        eventl.append((t-x, 'b-start', x))

    for i in range(q):
        d = int(input())
        eventl.append((d,'c-go', i))

    eventl.sort()

    ans = [0]*q
    hd = HeapDict()
    for e in eventl:
        if e[1] == 'a-stop':
            hd.insert(e[2])
        elif e[1] == 'b-start':
            hd.erase(e[2])
        else:
            min_x = hd.get_min()
            if min_x is not None:
                ans[e[2]] = min_x
            else:
                ans[e[2]] = -1

    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 eventl = [] eventl [] for _ in range(n):
        s,t,x = map(int, input().split())
        eventl.append((s-x, 'a-stop', x)) 
        eventl.append((t-x, 'b-start', x))

     _ 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 eventl.append((s-x, 'a-stop', x)) eventl.append eventl append (s-x, 'a-stop', x) s-x s x 'a-stop' x eventl.append((t-x, 'b-start', x)) eventl.append eventl append (t-x, 'b-start', x) t-x t x 'b-start' x for i in range(q):
        d = int(input())
        eventl.append((d,'c-go', i))

     i range(q) range q d = int(input()) d int(input()) int input() input eventl.append((d,'c-go', i)) eventl.append eventl append (d,'c-go', i) d 'c-go' i eventl.sort() eventl.sort eventl sort ans = [0]*q ans [0]*q [0] 0 q hd = HeapDict() hd HeapDict() HeapDict for e in eventl:
        if e[1] == 'a-stop':
            hd.insert(e[2])
        elif e[1] == 'b-start':
            hd.erase(e[2])
        else:
            min_x = hd.get_min()
            if min_x is not None:
                ans[e[2]] = min_x
            else:
                ans[e[2]] = -1

     e eventl if e[1] == 'a-stop':
            hd.insert(e[2])
        elif e[1] == 'b-start':
            hd.erase(e[2])
        else:
            min_x = hd.get_min()
            if min_x is not None:
                ans[e[2]] = min_x
            else:
                ans[e[2]] = -1

     e[1] == 'a-stop' e[1] e 1 'a-stop' hd.insert(e[2]) hd.insert hd insert e[2] e 2 elif e[1] == 'b-start':
            hd.erase(e[2])
         e[1] == 'b-start' e[1] e 1 'b-start' hd.erase(e[2]) hd.erase hd erase e[2] e 2 min_x = hd.get_min() min_x hd.get_min() hd.get_min hd get_min if min_x is not None:
                ans[e[2]] = min_x
            else:
                ans[e[2]] = -1

     min_x is not None min_x None ans[e[2]] = min_x ans[e[2]] ans e[2] e 2 min_x ans[e[2]] = -1 ans[e[2]] ans e[2] e 2 -1 for a in ans:
        print(a) a ans print(a) print a if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main class HeapDict:
    def __init__(self):
        self.h = []
        self.d = {}

    def insert(self,x):
        if x not in self.d or self.d[x] == 0:
            heapq.heappush(self.h, x)
        self.d.setdefault(x,0)
        self.d[x] += 1


    def erase(self,x):
        if x not in self.d or self.d[x] == 0:
            return
        else:
            self.d[x] -= 1

        while self.h:
            if self.d[self.h[0]] == 0:
                heapq.heappop(self.h)
            else:
                break


    def get_min(self):
        if not self.h:
            return None
        else:
            return self.h[0]


    def pop(self):
        poped_val = self.h[0]
        self.erase(poped_val)
        return poped_val


    def exist(self, x):
        return (x in self.d and self.d[x] > 0)


    def show_h(self):
        elems = [v for v in self.h if self.d[v] > 0]
        print(elems)


    def show_d(self):
        print(self.d) class HeapDict:
    def __init__(self):
        self.h = []
        self.d = {}

    def insert(self,x):
        if x not in self.d or self.d[x] == 0:
            heapq.heappush(self.h, x)
        self.d.setdefault(x,0)
        self.d[x] += 1


    def erase(self,x):
        if x not in self.d or self.d[x] == 0:
            return
        else:
            self.d[x] -= 1

        while self.h:
            if self.d[self.h[0]] == 0:
                heapq.heappop(self.h)
            else:
                break


    def get_min(self):
        if not self.h:
            return None
        else:
            return self.h[0]


    def pop(self):
        poped_val = self.h[0]
        self.erase(poped_val)
        return poped_val


    def exist(self, x):
        return (x in self.d and self.d[x] > 0)


    def show_h(self):
        elems = [v for v in self.h if self.d[v] > 0]
        print(elems)


    def show_d(self):
        print(self.d) HeapDict def main():
    n,q = map(int, input().split())
    eventl = []

    for _ in range(n):
        s,t,x = map(int, input().split())
        eventl.append((s-x, 'a-stop', x)) 
        eventl.append((t-x, 'b-start', x))

    for i in range(q):
        d = int(input())
        eventl.append((d,'c-go', i))

    eventl.sort()

    ans = [0]*q
    hd = HeapDict()
    for e in eventl:
        if e[1] == 'a-stop':
            hd.insert(e[2])
        elif e[1] == 'b-start':
            hd.erase(e[2])
        else:
            min_x = hd.get_min()
            if min_x is not None:
                ans[e[2]] = min_x
            else:
                ans[e[2]] = -1

    for a in ans:
        print(a) def main():
    n,q = map(int, input().split())
    eventl = []

    for _ in range(n):
        s,t,x = map(int, input().split())
        eventl.append((s-x, 'a-stop', x)) 
        eventl.append((t-x, 'b-start', x))

    for i in range(q):
        d = int(input())
        eventl.append((d,'c-go', i))

    eventl.sort()

    ans = [0]*q
    hd = HeapDict()
    for e in eventl:
        if e[1] == 'a-stop':
            hd.insert(e[2])
        elif e[1] == 'b-start':
            hd.erase(e[2])
        else:
            min_x = hd.get_min()
            if min_x is not None:
                ans[e[2]] = min_x
            else:
                ans[e[2]] = -1

    for a in ans:
        print(a) main
import heapq
class HeapDict:
    def __init__(self):
        self.h = []
        self.d = {}

    def insert(self,x):
        if x not in self.d or self.d[x] == 0:
            heapq.heappush(self.h, x)
        self.d.setdefault(x,0)
        self.d[x] += 1


    def erase(self,x):
        if x not in self.d or self.d[x] == 0:
            return
        else:
            self.d[x] -= 1

        while self.h:
            if self.d[self.h[0]] == 0:
                heapq.heappop(self.h)
            else:
                break


    def get_min(self):
        if not self.h:
            return None
        else:
            return self.h[0]


    def pop(self):
        poped_val = self.h[0]
        self.erase(poped_val)
        return poped_val


    def exist(self, x):
        return (x in self.d and self.d[x] > 0)


    def show_h(self):
        elems = [v for v in self.h if self.d[v] > 0]
        print(elems)


    def show_d(self):
        print(self.d)



def main():
    n,q = map(int, input().split())
    eventl = []

    for _ in range(n):
        s,t,x = map(int, input().split())
        eventl.append((s-x, 'a-stop', x)) 
        eventl.append((t-x, 'b-start', x))

    for i in range(q):
        d = int(input())
        eventl.append((d,'c-go', i))

    eventl.sort()

    ans = [0]*q
    hd = HeapDict()
    for e in eventl:
        if e[1] == 'a-stop':
            hd.insert(e[2])
        elif e[1] == 'b-start':
            hd.erase(e[2])
        else:
            min_x = hd.get_min()
            if min_x is not None:
                ans[e[2]] = min_x
            else:
                ans[e[2]] = -1

    for a in ans:
        print(a)


if __name__ == "__main__":
    main()