# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import sys
s = sys.stdin.readlines()
N, Q = map(int, s[0].split())
x_dict = {}
max_x = 0
for e in s[1:N]:
    S, T, X = map(int, e.split())
    if X in x_dict:
        for i in range(S - 1, T):
            x_dict[X].add(i + 0.5)
    else:
        x_dict[X] = {S - 0.5}
        for i in range(S, T):
            x_dict[X].add(i + 0.5)
    if max_x < X:
        max_x = X
for e in s[N + 1:]:
    D = int(e)
    place = 0
    inf_flg = 1
    for i in range(max_x + 1):
        time = D + i + 0.5
        if place in x_dict:
            if time in x_dict[place]:
                print(place)
                inf_flg = 0
                break
        place += 1
    if inf_flg == 1:
        print(-1)