import sys

input=sys.stdin.readline

N,Q=map(int,input().split())
kouji=[]
for i in range(0,N):
    s,t,x=map(int,input().split())
    kouji.append([x,s,t])

d=[]
for i in range(0,Q):
    d.append(int(input()))

kouji.sort(reverse=True)

# N: 処理する区間の長さ

N0 = 2**(Q-1).bit_length()
data = [None]*(2*N0)
INF = (-1,-1)
# 区間[l, r+1)の値をvに書き換える
# vは(t, value)という値にする (新しい値ほどtは大きくなる)
def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得
def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す
def query(k):
    return _query(k)[1]

time=0
for i in range(0,N):
    x,s,t=kouji[i]
    start=0
    end=Q-1
    while end-start>1:
        test=(end+start)//2
        if d[test]>=s-x:
            end=test
        else:
            start=test
    if d[start]>=s-x:
        l=start
    elif d[end]>=s-x:
        l=end
    else:
        l=Q

    start=0
    end=Q-1
    while end-start>1:
        test=(end+start)//2
        if t-x-1>=d[test]:
            start=test
        else:
            end=test
    if t-x-1>=d[end]:
        r=end
    elif t-x-1>=d[start]:
        r=start
    else:
        r=-1
    if r!=-1 and l!=Q and r>=l:
        update(l,r+1,(time,x))
    time+=1

for i in range(0,Q):
    print(query(i)) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N,Q=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split Q kouji=[] kouji [] for i in range(0,N):
    s,t,x=map(int,input().split())
    kouji.append([x,s,t]) i range(0,N) range 0 N s,t,x=map(int,input().split()) s map(int,input().split()) map int input().split() ().split () input split t x kouji.append([x,s,t]) kouji.append kouji append [x,s,t] x s t d=[] d [] for i in range(0,Q):
    d.append(int(input())) i range(0,Q) range 0 Q d.append(int(input())) d.append d append int(input()) int input() input kouji.sort(reverse=True) kouji.sort kouji sort reverse=True reverse True N0 = 2**(Q-1).bit_length() N0 2**(Q-1).bit_length() 2 (Q-1).bit_length() Q-1).bit_length Q-1 Q 1 bit_length data = [None]*(2*N0) data [None]*(2*N0) [None] None 2*N0 2 N0 INF = (-1,-1) INF (-1,-1) -1 -1 def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得 update L = l + N0 L l + N0 l N0 R = r + N0 R r + N0 r N0 while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得 L < R L R if R & 1:
            R -= 1
            data[R-1] = v

         R & 1 R 1 R -= 1 R 1 data[R-1] = v data[R-1] data R-1 R 1 v if L & 1:
            data[L-1] = v
            L += 1
         L & 1 L 1 data[L-1] = v data[L-1] data L-1 L 1 v L += 1 L 1 L >>= 1 L 1 R >>= 1 R 1 l l r r v v def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す _query k += N0-1 k N0-1 N0 1 s = INF s INF while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
     k >= 0 k 0 if data[k]:
            s = max(s, data[k])
         data[k] data k s = max(s, data[k]) s max(s, data[k]) max s data[k] data k k = (k - 1) // 2 k (k - 1) // 2 k - 1 k 1 2 return s s k k def query(k):
    return _query(k)[1] query return _query(k)[1] _query(k)[1] (k) _query k 1 k k time=0 time 0 for i in range(0,N):
    x,s,t=kouji[i]
    start=0
    end=Q-1
    while end-start>1:
        test=(end+start)//2
        if d[test]>=s-x:
            end=test
        else:
            start=test
    if d[start]>=s-x:
        l=start
    elif d[end]>=s-x:
        l=end
    else:
        l=Q

    start=0
    end=Q-1
    while end-start>1:
        test=(end+start)//2
        if t-x-1>=d[test]:
            start=test
        else:
            end=test
    if t-x-1>=d[end]:
        r=end
    elif t-x-1>=d[start]:
        r=start
    else:
        r=-1
    if r!=-1 and l!=Q and r>=l:
        update(l,r+1,(time,x))
    time+=1 i range(0,N) range 0 N x,s,t=kouji[i] x kouji[i] kouji i s t start=0 start 0 end=Q-1 end Q-1 Q 1 while end-start>1:
        test=(end+start)//2
        if d[test]>=s-x:
            end=test
        else:
            start=test
     end-start>1 end-start end start 1 test=(end+start)//2 test (end+start)//2 end+start end start 2 if d[test]>=s-x:
            end=test
        else:
            start=test
     d[test]>=s-x d[test] d test s-x s x end=test end test start=test start test if d[start]>=s-x:
        l=start
    elif d[end]>=s-x:
        l=end
    else:
        l=Q

     d[start]>=s-x d[start] d start s-x s x l=start l start elif d[end]>=s-x:
        l=end
     d[end]>=s-x d[end] d end s-x s x l=end l end l=Q l Q start=0 start 0 end=Q-1 end Q-1 Q 1 while end-start>1:
        test=(end+start)//2
        if t-x-1>=d[test]:
            start=test
        else:
            end=test
     end-start>1 end-start end start 1 test=(end+start)//2 test (end+start)//2 end+start end start 2 if t-x-1>=d[test]:
            start=test
        else:
            end=test
     t-x-1>=d[test] t-x-1 t-x t x 1 d[test] d test start=test start test end=test end test if t-x-1>=d[end]:
        r=end
    elif t-x-1>=d[start]:
        r=start
    else:
        r=-1
     t-x-1>=d[end] t-x-1 t-x t x 1 d[end] d end r=end r end elif t-x-1>=d[start]:
        r=start
     t-x-1>=d[start] t-x-1 t-x t x 1 d[start] d start r=start r start r=-1 r -1 if r!=-1 and l!=Q and r>=l:
        update(l,r+1,(time,x))
     r!=-1 and l!=Q and r>=l r!=-1 and l!=Q r!=-1 r -1 l!=Q l Q r>=l r l update(l,r+1,(time,x)) update l r+1 r 1 (time,x) time x time+=1 time 1 for i in range(0,Q):
    print(query(i)) i range(0,Q) range 0 Q print(query(i)) print query(i) query i x=map(int,input().split()) map(int,input().split()) x r=-1 -1 r def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得 def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得 update N0 = 2**(Q-1).bit_length() 2**(Q-1).bit_length() N0 s,t=kouji[i] kouji[i] s end=Q-1 Q-1 end data = [None]*(2*N0) [None]*(2*N0) data test=(end+start)//2 (end+start)//2 test test=(end+start)//2 (end+start)//2 test l=end end l Q=map(int,input().split()) map(int,input().split()) Q t,x=map(int,input().split()) map(int,input().split()) t t=kouji[i] kouji[i] t input=sys.stdin.readline sys.stdin.readline input def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す _query start=test test start def query(k):
    return _query(k)[1] def query(k):
    return _query(k)[1] query time=0 0 time l=start start l end=test test end r=start start r start=0 0 start end=Q-1 Q-1 end INF = (-1,-1) (-1,-1) INF x,s,t=kouji[i] kouji[i] x start=0 0 start start=test test start N,Q=map(int,input().split()) map(int,input().split()) N end=test test end time+=1 1 time s,t,x=map(int,input().split()) map(int,input().split()) s d=[] [] d kouji=[] [] kouji r=end end r l=Q Q l
import sys

input=sys.stdin.readline

N,Q=map(int,input().split())
kouji=[]
for i in range(0,N):
    s,t,x=map(int,input().split())
    kouji.append([x,s,t])

d=[]
for i in range(0,Q):
    d.append(int(input()))

kouji.sort(reverse=True)

# N: 処理する区間の長さ

N0 = 2**(Q-1).bit_length()
data = [None]*(2*N0)
INF = (-1,-1)
# 区間[l, r+1)の値をvに書き換える
# vは(t, value)という値にする (新しい値ほどtは大きくなる)
def update(l, r, v):
    L = l + N0; R = r + N0
    while L < R:
        if R & 1:
            R -= 1
            data[R-1] = v

        if L & 1:
            data[L-1] = v
            L += 1
        L >>= 1; R >>= 1
# a_iの現在の値を取得
def _query(k):
    k += N0-1
    s = INF
    while k >= 0:
        if data[k]:
            s = max(s, data[k])
        k = (k - 1) // 2
    return s
# これを呼び出す
def query(k):
    return _query(k)[1]

time=0
for i in range(0,N):
    x,s,t=kouji[i]
    start=0
    end=Q-1
    while end-start>1:
        test=(end+start)//2
        if d[test]>=s-x:
            end=test
        else:
            start=test
    if d[start]>=s-x:
        l=start
    elif d[end]>=s-x:
        l=end
    else:
        l=Q

    start=0
    end=Q-1
    while end-start>1:
        test=(end+start)//2
        if t-x-1>=d[test]:
            start=test
        else:
            end=test
    if t-x-1>=d[end]:
        r=end
    elif t-x-1>=d[start]:
        r=start
    else:
        r=-1
    if r!=-1 and l!=Q and r>=l:
        update(l,r+1,(time,x))
    time+=1

for i in range(0,Q):
    print(query(i))
