import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

# random_denseがTLE, 他はAC
"""
from bisect import bisect_left, bisect_right  # 二分探索
def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み
    E = [-1] * Q
    STX.sort(key=lambda v: v[2])
    for s, t, x in STX:
        a = bisect_left(D, s-x)
        b = bisect_left(D, t-x)
        for i in range(a, b):
            if E[i] == -1:
                E[i] = x
    for e in E:
        print(e)
"""

def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み

    events = []
    for s, t, x in STX:
        events.append(('S', s-x-0.25, x))
        events.append(('T', t-x-0.75, x))  # 0.5 同士だと [1, 2), [0, 1) で吹き飛ぶ
    for i, d in enumerate(D):
        events.append(('D', d, i))
    
    ans = [-1] * Q
    events.sort(key=lambda v: v[1])
    xset = set()
    xmin = 1e+10
    for event, time, xi in events:
        if event == 'S':
            xset.add(xi)
            if xmin > xi:
                xmin = xi
        elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
        elif event == 'D' and xset:
            ans[xi] = xmin

    for n in ans:
        print(n)

main() import sys sys int(c) for c in s.split(' ') for c in s.split(' ') c s.split(' ') s.split s split ' ' for c in s.split(' ') int(c) int c s2nn = lambda s: [int(c) for c in s.split(' ')] s2nn lambda s: [int(c) for c in s.split(' ')] [int(c) for c in s.split(' ')] s int(s) for s in ss for s in ss s ss for s in ss int(s) int s ss2nn = lambda ss: [int(s) for s in ss] ss2nn lambda ss: [int(s) for s in ss] [int(s) for s in ss] ss s2nn(s) for s in ss for s in ss s ss for s in ss s2nn(s) s2nn s ss2nnn = lambda ss: [s2nn(s) for s in ss] ss2nnn lambda ss: [s2nn(s) for s in ss] [s2nn(s) for s in ss] ss i2s = lambda: sys.stdin.readline().rstrip() i2s lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip i2n = lambda: int(i2s()) i2n lambda: int(i2s()) int(i2s()) int i2s() i2s i2nn = lambda: s2nn(i2s()) i2nn lambda: s2nn(i2s()) s2nn(i2s()) s2nn i2s() i2s sys.stdin.readline().rstrip() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)] ii2ss lambda n: [sys.stdin.readline().rstrip() for _ in range(n)] [sys.stdin.readline().rstrip() for _ in range(n)] n list(sys.stdin.readline().rstrip()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(sys.stdin.readline().rstrip()) list sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)] ii2sss lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)] [list(sys.stdin.readline().rstrip()) for _ in range(n)] n ii2nn = lambda n: ss2nn(ii2ss(n)) ii2nn lambda n: ss2nn(ii2ss(n)) ss2nn(ii2ss(n)) ss2nn ii2ss(n) ii2ss n n ii2nnn = lambda n: ss2nnn(ii2ss(n)) ii2nnn lambda n: ss2nnn(ii2ss(n)) ss2nnn(ii2ss(n)) ss2nnn ii2ss(n) ii2ss n n """
from bisect import bisect_left, bisect_right  # 二分探索
def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み
    E = [-1] * Q
    STX.sort(key=lambda v: v[2])
    for s, t, x in STX:
        a = bisect_left(D, s-x)
        b = bisect_left(D, t-x)
        for i in range(a, b):
            if E[i] == -1:
                E[i] = x
    for e in E:
        print(e)
""" def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み

    events = []
    for s, t, x in STX:
        events.append(('S', s-x-0.25, x))
        events.append(('T', t-x-0.75, x))  # 0.5 同士だと [1, 2), [0, 1) で吹き飛ぶ
    for i, d in enumerate(D):
        events.append(('D', d, i))
    
    ans = [-1] * Q
    events.sort(key=lambda v: v[1])
    xset = set()
    xmin = 1e+10
    for event, time, xi in events:
        if event == 'S':
            xset.add(xi)
            if xmin > xi:
                xmin = xi
        elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
        elif event == 'D' and xset:
            ans[xi] = xmin

    for n in ans:
        print(n) main N, Q = i2nn() N i2nn() i2nn Q STX = ii2nnn(N) STX ii2nnn(N) ii2nnn N D = ii2nn(Q) D ii2nn(Q) ii2nn Q events = [] events [] for s, t, x in STX:
        events.append(('S', s-x-0.25, x))
        events.append(('T', t-x-0.75, x))  # 0.5 同士だと [1, 2), [0, 1) で吹き飛ぶ
     s t x STX events.append(('S', s-x-0.25, x)) events.append events append ('S', s-x-0.25, x) 'S' s-x-0.25 s-x s x 0.25 x events.append(('T', t-x-0.75, x)) events.append events append ('T', t-x-0.75, x) 'T' t-x-0.75 t-x t x 0.75 x for i, d in enumerate(D):
        events.append(('D', d, i))
    
     i d enumerate(D) enumerate D events.append(('D', d, i)) events.append events append ('D', d, i) 'D' d i ans = [-1] * Q ans [-1] * Q [-1] -1 Q events.sort(key=lambda v: v[1]) events.sort events sort key=lambda v: v[1] key lambda v: v[1] v[1] v 1 v xset = set() xset set() set xmin = 1e+10 xmin 1e+10 for event, time, xi in events:
        if event == 'S':
            xset.add(xi)
            if xmin > xi:
                xmin = xi
        elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
        elif event == 'D' and xset:
            ans[xi] = xmin

     event time xi events if event == 'S':
            xset.add(xi)
            if xmin > xi:
                xmin = xi
        elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
        elif event == 'D' and xset:
            ans[xi] = xmin

     event == 'S' event 'S' xset.add(xi) xset.add xset add xi if xmin > xi:
                xmin = xi
         xmin > xi xmin xi xmin = xi xmin xi elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
         event == 'T' event 'T' xset.remove(xi) xset.remove xset remove xi if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
         xmin == xi xmin xi if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
         xset xmin = min(xset) xmin min(xset) min xset xmin = 1e+10 xmin 1e+10 elif event == 'D' and xset:
            ans[xi] = xmin

     event == 'D' and xset event == 'D' event 'D' xset ans[xi] = xmin ans[xi] ans xi xmin for n in ans:
        print(n) n ans print(n) print n main() main ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)] lambda n: [sys.stdin.readline().rstrip() for _ in range(n)] ii2ss s2nn = lambda s: [int(c) for c in s.split(' ')] lambda s: [int(c) for c in s.split(' ')] s2nn ss2nnn = lambda ss: [s2nn(s) for s in ss] lambda ss: [s2nn(s) for s in ss] ss2nnn i2nn = lambda: s2nn(i2s()) lambda: s2nn(i2s()) i2nn ii2nnn = lambda n: ss2nnn(ii2ss(n)) lambda n: ss2nnn(ii2ss(n)) ii2nnn ss2nn = lambda ss: [int(s) for s in ss] lambda ss: [int(s) for s in ss] ss2nn ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)] lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)] ii2sss i2n = lambda: int(i2s()) lambda: int(i2s()) i2n ii2nn = lambda n: ss2nn(ii2ss(n)) lambda n: ss2nn(ii2ss(n)) ii2nn def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み

    events = []
    for s, t, x in STX:
        events.append(('S', s-x-0.25, x))
        events.append(('T', t-x-0.75, x))  # 0.5 同士だと [1, 2), [0, 1) で吹き飛ぶ
    for i, d in enumerate(D):
        events.append(('D', d, i))
    
    ans = [-1] * Q
    events.sort(key=lambda v: v[1])
    xset = set()
    xmin = 1e+10
    for event, time, xi in events:
        if event == 'S':
            xset.add(xi)
            if xmin > xi:
                xmin = xi
        elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
        elif event == 'D' and xset:
            ans[xi] = xmin

    for n in ans:
        print(n) def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み

    events = []
    for s, t, x in STX:
        events.append(('S', s-x-0.25, x))
        events.append(('T', t-x-0.75, x))  # 0.5 同士だと [1, 2), [0, 1) で吹き飛ぶ
    for i, d in enumerate(D):
        events.append(('D', d, i))
    
    ans = [-1] * Q
    events.sort(key=lambda v: v[1])
    xset = set()
    xmin = 1e+10
    for event, time, xi in events:
        if event == 'S':
            xset.add(xi)
            if xmin > xi:
                xmin = xi
        elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
        elif event == 'D' and xset:
            ans[xi] = xmin

    for n in ans:
        print(n) main i2s = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() i2s
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

# random_denseがTLE, 他はAC
"""
from bisect import bisect_left, bisect_right  # 二分探索
def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み
    E = [-1] * Q
    STX.sort(key=lambda v: v[2])
    for s, t, x in STX:
        a = bisect_left(D, s-x)
        b = bisect_left(D, t-x)
        for i in range(a, b):
            if E[i] == -1:
                E[i] = x
    for e in E:
        print(e)
"""

def main():
    N, Q = i2nn()
    STX = ii2nnn(N) # 座標 X で時刻 [S, T) が工事
    D = ii2nn(Q)    # 昇順ソート済み

    events = []
    for s, t, x in STX:
        events.append(('S', s-x-0.25, x))
        events.append(('T', t-x-0.75, x))  # 0.5 同士だと [1, 2), [0, 1) で吹き飛ぶ
    for i, d in enumerate(D):
        events.append(('D', d, i))
    
    ans = [-1] * Q
    events.sort(key=lambda v: v[1])
    xset = set()
    xmin = 1e+10
    for event, time, xi in events:
        if event == 'S':
            xset.add(xi)
            if xmin > xi:
                xmin = xi
        elif event == 'T':
            xset.remove(xi)
            if xmin == xi:
                if xset:
                    xmin = min(xset)
                else:
                    xmin = 1e+10
        elif event == 'D' and xset:
            ans[xi] = xmin

    for n in ans:
        print(n)

main()
