
n,q=[int(j) for j in input().split()]
l=[]
for i in range(n):
    s,t,x=[int(j) for j in input().split()]
    l.append((s-x,1,x))
    l.append((t-x,0,x))

for i in range(q):
    d=int(input())
    l.append((d,2,i))

l.sort()

ans=[-1]*q
ll=set()
m=10**18
p=False
for i,j,x in l:
    if j==1:
        ll.add(x)
        if m>x:
            m=x
            p=True
    elif j==0:
        ll.remove(x)
        if x==m:
            p=False
    else:
        if not p:
            if ll:
                p=True
                m=min(ll)
            else:
                m=-1
        ans[x]=m
print('\n'.join(map(str,ans)))
 int(j) for j in input().split() for j in input().split() j input().split() ().split () input split for j in input().split() int(j) int j n,q=[int(j) for j in input().split()] n [int(j) for j in input().split()] q l=[] l [] for i in range(n):
    s,t,x=[int(j) for j in input().split()]
    l.append((s-x,1,x))
    l.append((t-x,0,x)) i range(n) range n int(j) for j in input().split() for j in input().split() j input().split() ().split () input split for j in input().split() int(j) int j s,t,x=[int(j) for j in input().split()] s [int(j) for j in input().split()] t x l.append((s-x,1,x)) l.append l append (s-x,1,x) s-x s x 1 x l.append((t-x,0,x)) l.append l append (t-x,0,x) t-x t x 0 x for i in range(q):
    d=int(input())
    l.append((d,2,i)) i range(q) range q d=int(input()) d int(input()) int input() input l.append((d,2,i)) l.append l append (d,2,i) d 2 i l.sort() l.sort l sort ans=[-1]*q ans [-1]*q [-1] -1 q ll=set() ll set() set m=10**18 m 10**18 10 18 p=False p False for i,j,x in l:
    if j==1:
        ll.add(x)
        if m>x:
            m=x
            p=True
    elif j==0:
        ll.remove(x)
        if x==m:
            p=False
    else:
        if not p:
            if ll:
                p=True
                m=min(ll)
            else:
                m=-1
        ans[x]=m i j x l if j==1:
        ll.add(x)
        if m>x:
            m=x
            p=True
    elif j==0:
        ll.remove(x)
        if x==m:
            p=False
    else:
        if not p:
            if ll:
                p=True
                m=min(ll)
            else:
                m=-1
        ans[x]=m j==1 j 1 ll.add(x) ll.add ll add x if m>x:
            m=x
            p=True
     m>x m x m=x m x p=True p True elif j==0:
        ll.remove(x)
        if x==m:
            p=False
     j==0 j 0 ll.remove(x) ll.remove ll remove x if x==m:
            p=False
     x==m x m p=False p False if not p:
            if ll:
                p=True
                m=min(ll)
            else:
                m=-1
         not p p if ll:
                p=True
                m=min(ll)
            else:
                m=-1
         ll p=True p True m=min(ll) m min(ll) min ll m=-1 m -1 ans[x]=m ans[x] ans x m print('\n'.join(map(str,ans))) print '\n'.join(map(str,ans)) '\n'.join '\n' join map(str,ans) map str ans q=[int(j) for j in input().split()] [int(j) for j in input().split()] q p=False False p ll=set() set() ll d=int(input()) int(input()) d m=min(ll) min(ll) m l=[] [] l x=[int(j) for j in input().split()] [int(j) for j in input().split()] x p=True True p m=10**18 10**18 m t,x=[int(j) for j in input().split()] [int(j) for j in input().split()] t n,q=[int(j) for j in input().split()] [int(j) for j in input().split()] n s,t,x=[int(j) for j in input().split()] [int(j) for j in input().split()] s p=False False p p=True True p m=-1 -1 m ans=[-1]*q [-1]*q ans m=x x m

n,q=[int(j) for j in input().split()]
l=[]
for i in range(n):
    s,t,x=[int(j) for j in input().split()]
    l.append((s-x,1,x))
    l.append((t-x,0,x))

for i in range(q):
    d=int(input())
    l.append((d,2,i))

l.sort()

ans=[-1]*q
ll=set()
m=10**18
p=False
for i,j,x in l:
    if j==1:
        ll.add(x)
        if m>x:
            m=x
            p=True
    elif j==0:
        ll.remove(x)
        if x==m:
            p=False
    else:
        if not p:
            if ll:
                p=True
                m=min(ll)
            else:
                m=-1
        ans[x]=m
print('\n'.join(map(str,ans)))

