from operator import itemgetter
import sys

input = sys.stdin.readline

inf = float('inf')

N, Q = map(int, input().split())

es = []
for _ in range(N):
    s, t, x = map(int, input().split())
    es.append((s - x, 1, x))
    es.append((t - x - 0.5, -1, x))

es.sort(key=itemgetter(0))
st = set()
cur_min_stop = inf
check_needed = True

# print(es)
i = 0
for _ in range(Q):
    d = int(input())
    while i < N * 2:
        time, typ, pos = es[i]
        # print(es[i])
        if time > d:
            break
        if typ == 1:
            st.add(pos)
            if pos < cur_min_stop:
                cur_min_stop = pos
        else:
            st.remove(pos)
            if pos == cur_min_stop:
                check_needed = True
        i = i + 1

    if check_needed:
        if st:
            cur_min_stop = min(st)
        else:
            cur_min_stop = inf
        check_needed = False
    print(cur_min_stop if cur_min_stop < inf else -1) from operator import itemgetter import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline inf = float('inf') inf float('inf') float 'inf' N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q es = [] es [] for _ in range(N):
    s, t, x = map(int, input().split())
    es.append((s - x, 1, x))
    es.append((t - x - 0.5, -1, x)) _ range(N) range N s, t, x = map(int, input().split()) s map(int, input().split()) map int input().split() ().split () input split t x es.append((s - x, 1, x)) es.append es append (s - x, 1, x) s - x s x 1 x es.append((t - x - 0.5, -1, x)) es.append es append (t - x - 0.5, -1, x) t - x - 0.5 t - x t x 0.5 -1 x es.sort(key=itemgetter(0)) es.sort es sort key=itemgetter(0) key itemgetter(0) itemgetter 0 st = set() st set() set cur_min_stop = inf cur_min_stop inf check_needed = True check_needed True i = 0 i 0 for _ in range(Q):
    d = int(input())
    while i < N * 2:
        time, typ, pos = es[i]
        # print(es[i])
        if time > d:
            break
        if typ == 1:
            st.add(pos)
            if pos < cur_min_stop:
                cur_min_stop = pos
        else:
            st.remove(pos)
            if pos == cur_min_stop:
                check_needed = True
        i = i + 1

    if check_needed:
        if st:
            cur_min_stop = min(st)
        else:
            cur_min_stop = inf
        check_needed = False
    print(cur_min_stop if cur_min_stop < inf else -1) _ range(Q) range Q d = int(input()) d int(input()) int input() input while i < N * 2:
        time, typ, pos = es[i]
        # print(es[i])
        if time > d:
            break
        if typ == 1:
            st.add(pos)
            if pos < cur_min_stop:
                cur_min_stop = pos
        else:
            st.remove(pos)
            if pos == cur_min_stop:
                check_needed = True
        i = i + 1

     i < N * 2 i N * 2 N 2 time, typ, pos = es[i] time es[i] es i typ pos if time > d:
            break
         time > d time d break if typ == 1:
            st.add(pos)
            if pos < cur_min_stop:
                cur_min_stop = pos
        else:
            st.remove(pos)
            if pos == cur_min_stop:
                check_needed = True
         typ == 1 typ 1 st.add(pos) st.add st add pos if pos < cur_min_stop:
                cur_min_stop = pos
         pos < cur_min_stop pos cur_min_stop cur_min_stop = pos cur_min_stop pos st.remove(pos) st.remove st remove pos if pos == cur_min_stop:
                check_needed = True
         pos == cur_min_stop pos cur_min_stop check_needed = True check_needed True i = i + 1 i i + 1 i 1 if check_needed:
        if st:
            cur_min_stop = min(st)
        else:
            cur_min_stop = inf
        check_needed = False
     check_needed if st:
            cur_min_stop = min(st)
        else:
            cur_min_stop = inf
         st cur_min_stop = min(st) cur_min_stop min(st) min st cur_min_stop = inf cur_min_stop inf check_needed = False check_needed False print(cur_min_stop if cur_min_stop < inf else -1) print cur_min_stop if cur_min_stop < inf else -1 cur_min_stop < inf cur_min_stop inf cur_min_stop -1 input = sys.stdin.readline sys.stdin.readline input pos = es[i] es[i] pos cur_min_stop = pos pos cur_min_stop cur_min_stop = inf inf cur_min_stop i = i + 1 i + 1 i typ, pos = es[i] es[i] typ d = int(input()) int(input()) d time, typ, pos = es[i] es[i] time inf = float('inf') float('inf') inf es = [] [] es Q = map(int, input().split()) map(int, input().split()) Q cur_min_stop = min(st) min(st) cur_min_stop N, Q = map(int, input().split()) map(int, input().split()) N t, x = map(int, input().split()) map(int, input().split()) t i = 0 0 i check_needed = False False check_needed cur_min_stop = inf inf cur_min_stop s, t, x = map(int, input().split()) map(int, input().split()) s check_needed = True True check_needed st = set() set() st check_needed = True True check_needed x = map(int, input().split()) map(int, input().split()) x
from operator import itemgetter
import sys

input = sys.stdin.readline

inf = float('inf')

N, Q = map(int, input().split())

es = []
for _ in range(N):
    s, t, x = map(int, input().split())
    es.append((s - x, 1, x))
    es.append((t - x - 0.5, -1, x))

es.sort(key=itemgetter(0))
st = set()
cur_min_stop = inf
check_needed = True

# print(es)
i = 0
for _ in range(Q):
    d = int(input())
    while i < N * 2:
        time, typ, pos = es[i]
        # print(es[i])
        if time > d:
            break
        if typ == 1:
            st.add(pos)
            if pos < cur_min_stop:
                cur_min_stop = pos
        else:
            st.remove(pos)
            if pos == cur_min_stop:
                check_needed = True
        i = i + 1

    if check_needed:
        if st:
            cur_min_stop = min(st)
        else:
            cur_min_stop = inf
        check_needed = False
    print(cur_min_stop if cur_min_stop < inf else -1)
