from subprocess import*

call(('pypy3','-c',r"""

def main():

    from bisect import bisect_left

    I=10**9+1

    n,q,*t=map(int,open(0).read().split())

    d=tuple(t[-q:])

    t=t[:-q]

    N0=2**(q-1).bit_length()

    data=[I]*2*N0

    for x,l,r in sorted(((x,bisect_left(d,s-x)+N0,bisect_left(d,t-x)+N0)for s,t,x in zip(t[::3],t[1::3],t[2::3])),reverse=1):

        while l<r:

            if r&1:

                r-=1

                data[r-1]=x

            if l&1:

                data[l-1]=x

                l+=1

            l//=2

            r//=2

    a=[]

    for k in range(N0-1,q+N0-1):

        s=I

        while~k:

            if data[k]<s:s=data[k]

            k=(k-1)//2

        a.append(-(s==I)or s)

    print('\n'.join(map(str,a)))

main()

"""))
from bisect import*

b=bisect_left

n,q,*t=list(map(int,open(0).read().split()))

p=t[-q:]

*a,=o=[-1]*q

for x,t,s in sorted(zip(*[iter(t[~q::-1])]*3)):

 l,r=b(p,s-x),b(p,t-x)

 while l<r:

  if~o[l]:l=o[l]

  else:a[l],o[l]=x,r;l+=1

print((*a))
from subprocess import *

call(
    (
        "pypy3",
        "-c",
        r"""
def main():
    from bisect import bisect_left
    I=10**9+1
    n,q,*t=map(int,open(0).read().split())
    d=tuple(t[-q:])
    t=t[:-q]
    N0=2**(q-1).bit_length()
    data=[I]*2*N0
    for x,l,r in sorted(((x,bisect_left(d,s-x)+N0,bisect_left(d,t-x)+N0)for s,t,x in zip(t[::3],t[1::3],t[2::3])),reverse=1):
        while l<r:
            if r&1:
                r-=1
                data[r-1]=x
            if l&1:
                data[l-1]=x
                l+=1
            l//=2
            r//=2
    a=[]
    for k in range(N0-1,q+N0-1):
        s=I
        while~k:
            if data[k]<s:s=data[k]
            k=(k-1)//2
        a.append(-(s==I)or s)
    print('\n'.join(map(str,a)))
main()
""",
    )
)

from bisect import *

b = bisect_left
n, q, *t = list(map(int, open(0).read().split()))
p = t[-q:]
(*a,) = o = [-1] * q
for x, t, s in sorted(zip(*[iter(t[~q::-1])] * 3)):
    l, r = b(p, s - x), b(p, t - x)
    while l < r:
        if ~o[l]:
            l = o[l]
        else:
            a[l], o[l] = x, r
            l += 1
print((*a))

-from subprocess import * +from bisect import * -call( -    ( -        "pypy3", -        "-c", -        r""" -def main(): -    from bisect import bisect_left -    I=10**9+1 -    n,q,*t=map(int,open(0).read().split()) -    d=tuple(t[-q:]) -    t=t[:-q] -    N0=2**(q-1).bit_length() -    data=[I]*2*N0 -    for x,l,r in sorted(((x,bisect_left(d,s-x)+N0,bisect_left(d,t-x)+N0)for s,t,x in zip(t[::3],t[1::3],t[2::3])),reverse=1): -        while l<r: -            if r&1: -                r-=1 -                data[r-1]=x -            if l&1: -                data[l-1]=x -                l+=1 -            l//=2 -            r//=2 -    a=[] -    for k in range(N0-1,q+N0-1): -        s=I -        while~k: -            if data[k]<s:s=data[k] -            k=(k-1)//2 -        a.append(-(s==I)or s) -    print('\n'.join(map(str,a))) -main() -""", -    ) -) +b = bisect_left +n, q, *t = list(map(int, open(0).read().split())) +p = t[-q:] +(*a,) = o = [-1] * q +for x, t, s in sorted(zip(*[iter(t[~q::-1])] * 3)): +    l, r = b(p, s - x), b(p, t - x) +    while l < r: +        if ~o[l]: +            l = o[l] +        else: +            a[l], o[l] = x, r +            l += 1 +print((*a))