'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n,q = map(int,ipt().split())
    base = 10**9+1
    hq = []
    for i in range(n):
        s,t,x = map(int,ipt().split())
        if t < x:
            continue
        hpq.heappush(hq,max(0,(s-x))*2*base+x*2+1)
        hpq.heappush(hq,(t-x)*2*base+x*2)

#    print(hq)
    iv = []
    dd = dict()
    for i in range(q):
        f = True
        d = (int(ipt())+1)*2*base
        while hq and hq[0] < d:
            hi = hpq.heappop(hq)
            t = hi//(2*base)
            p = hi%2
            x = (hi//2)%base
            if p:
                dd[x] = True
                hpq.heappush(iv,x)
            else:
                dd[x] = False
        while iv:
            ii = iv[0]
            if dd[ii]:
                print(ii)
                f = False
                break
            else:
                hpq.heappop(iv)
        if f:
            print(-1)

    return None

if __name__ == '__main__':
    main() '''
自宅用PCでの解答
''' import math math import itertools itertools import queue queue import bisect bisect from collections import deque,defaultdict import heapq as hpq heapq from sys import stdin,setrecursionlimit ipt = stdin.readline ipt stdin.readline stdin readline setrecursionlimit(10**7) setrecursionlimit 10**7 10 7 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 dir = [(-1,0),(0,-1),(1,0),(0,1)] dir [(-1,0),(0,-1),(1,0),(0,1)] (-1,0) -1 0 (0,-1) 0 -1 (1,0) 1 0 (0,1) 0 1 alp = "abcdefghijklmnopqrstuvwxyz" alp "abcdefghijklmnopqrstuvwxyz" def main():
    n,q = map(int,ipt().split())
    base = 10**9+1
    hq = []
    for i in range(n):
        s,t,x = map(int,ipt().split())
        if t < x:
            continue
        hpq.heappush(hq,max(0,(s-x))*2*base+x*2+1)
        hpq.heappush(hq,(t-x)*2*base+x*2)

#    print(hq)
    iv = []
    dd = dict()
    for i in range(q):
        f = True
        d = (int(ipt())+1)*2*base
        while hq and hq[0] < d:
            hi = hpq.heappop(hq)
            t = hi//(2*base)
            p = hi%2
            x = (hi//2)%base
            if p:
                dd[x] = True
                hpq.heappush(iv,x)
            else:
                dd[x] = False
        while iv:
            ii = iv[0]
            if dd[ii]:
                print(ii)
                f = False
                break
            else:
                hpq.heappop(iv)
        if f:
            print(-1)

    return None main n,q = map(int,ipt().split()) n map(int,ipt().split()) map int ipt().split() ().split () ipt split q base = 10**9+1 base 10**9+1 10**9 10 9 1 hq = [] hq [] for i in range(n):
        s,t,x = map(int,ipt().split())
        if t < x:
            continue
        hpq.heappush(hq,max(0,(s-x))*2*base+x*2+1)
        hpq.heappush(hq,(t-x)*2*base+x*2)

#    print(hq)
     i range(n) range n s,t,x = map(int,ipt().split()) s map(int,ipt().split()) map int ipt().split() ().split () ipt split t x if t < x:
            continue
         t < x t x continue hpq.heappush(hq,max(0,(s-x))*2*base+x*2+1) hpq.heappush hpq heappush hq max(0,(s-x))*2*base+x*2+1 max(0,(s-x))*2*base+x*2 max(0,(s-x))*2*base max(0,(s-x))*2 max(0,(s-x)) max 0 s-x s x 2 base x*2 x 2 1 hpq.heappush(hq,(t-x)*2*base+x*2) hpq.heappush hpq heappush hq (t-x)*2*base+x*2 (t-x)*2*base (t-x)*2 t-x t x 2 base x*2 x 2 iv = [] iv [] dd = dict() dd dict() dict for i in range(q):
        f = True
        d = (int(ipt())+1)*2*base
        while hq and hq[0] < d:
            hi = hpq.heappop(hq)
            t = hi//(2*base)
            p = hi%2
            x = (hi//2)%base
            if p:
                dd[x] = True
                hpq.heappush(iv,x)
            else:
                dd[x] = False
        while iv:
            ii = iv[0]
            if dd[ii]:
                print(ii)
                f = False
                break
            else:
                hpq.heappop(iv)
        if f:
            print(-1)

     i range(q) range q f = True f True d = (int(ipt())+1)*2*base d (int(ipt())+1)*2*base (int(ipt())+1)*2 int(ipt())+1 int(ipt()) int ipt() ipt 1 2 base while hq and hq[0] < d:
            hi = hpq.heappop(hq)
            t = hi//(2*base)
            p = hi%2
            x = (hi//2)%base
            if p:
                dd[x] = True
                hpq.heappush(iv,x)
            else:
                dd[x] = False
         hq and hq[0] < d hq hq[0] < d hq[0] hq 0 d hi = hpq.heappop(hq) hi hpq.heappop(hq) hpq.heappop hpq heappop hq t = hi//(2*base) t hi//(2*base) hi 2*base 2 base p = hi%2 p hi%2 hi 2 x = (hi//2)%base x (hi//2)%base hi//2 hi 2 base if p:
                dd[x] = True
                hpq.heappush(iv,x)
            else:
                dd[x] = False
         p dd[x] = True dd[x] dd x True hpq.heappush(iv,x) hpq.heappush hpq heappush iv x dd[x] = False dd[x] dd x False while iv:
            ii = iv[0]
            if dd[ii]:
                print(ii)
                f = False
                break
            else:
                hpq.heappop(iv)
         iv ii = iv[0] ii iv[0] iv 0 if dd[ii]:
                print(ii)
                f = False
                break
            else:
                hpq.heappop(iv)
         dd[ii] dd ii print(ii) print ii f = False f False break hpq.heappop(iv) hpq.heappop hpq heappop iv if f:
            print(-1)

     f print(-1) print -1 return None None if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main mod = 10**9+7 10**9+7 mod alp = "abcdefghijklmnopqrstuvwxyz" "abcdefghijklmnopqrstuvwxyz" alp def main():
    n,q = map(int,ipt().split())
    base = 10**9+1
    hq = []
    for i in range(n):
        s,t,x = map(int,ipt().split())
        if t < x:
            continue
        hpq.heappush(hq,max(0,(s-x))*2*base+x*2+1)
        hpq.heappush(hq,(t-x)*2*base+x*2)

#    print(hq)
    iv = []
    dd = dict()
    for i in range(q):
        f = True
        d = (int(ipt())+1)*2*base
        while hq and hq[0] < d:
            hi = hpq.heappop(hq)
            t = hi//(2*base)
            p = hi%2
            x = (hi//2)%base
            if p:
                dd[x] = True
                hpq.heappush(iv,x)
            else:
                dd[x] = False
        while iv:
            ii = iv[0]
            if dd[ii]:
                print(ii)
                f = False
                break
            else:
                hpq.heappop(iv)
        if f:
            print(-1)

    return None def main():
    n,q = map(int,ipt().split())
    base = 10**9+1
    hq = []
    for i in range(n):
        s,t,x = map(int,ipt().split())
        if t < x:
            continue
        hpq.heappush(hq,max(0,(s-x))*2*base+x*2+1)
        hpq.heappush(hq,(t-x)*2*base+x*2)

#    print(hq)
    iv = []
    dd = dict()
    for i in range(q):
        f = True
        d = (int(ipt())+1)*2*base
        while hq and hq[0] < d:
            hi = hpq.heappop(hq)
            t = hi//(2*base)
            p = hi%2
            x = (hi//2)%base
            if p:
                dd[x] = True
                hpq.heappush(iv,x)
            else:
                dd[x] = False
        while iv:
            ii = iv[0]
            if dd[ii]:
                print(ii)
                f = False
                break
            else:
                hpq.heappop(iv)
        if f:
            print(-1)

    return None main ipt = stdin.readline stdin.readline ipt dir = [(-1,0),(0,-1),(1,0),(0,1)] [(-1,0),(0,-1),(1,0),(0,1)] dir
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"

def main():
    n,q = map(int,ipt().split())
    base = 10**9+1
    hq = []
    for i in range(n):
        s,t,x = map(int,ipt().split())
        if t < x:
            continue
        hpq.heappush(hq,max(0,(s-x))*2*base+x*2+1)
        hpq.heappush(hq,(t-x)*2*base+x*2)

#    print(hq)
    iv = []
    dd = dict()
    for i in range(q):
        f = True
        d = (int(ipt())+1)*2*base
        while hq and hq[0] < d:
            hi = hpq.heappop(hq)
            t = hi//(2*base)
            p = hi%2
            x = (hi//2)%base
            if p:
                dd[x] = True
                hpq.heappush(iv,x)
            else:
                dd[x] = False
        while iv:
            ii = iv[0]
            if dd[ii]:
                print(ii)
                f = False
                break
            else:
                hpq.heappop(iv)
        if f:
            print(-1)

    return None

if __name__ == '__main__':
    main()
