n,q = map(int, input().split())
STXlist = [list(map(int,input().split())) for _ in range(n)]
D = [(-1)*int(input()) for _ in range(q)]

time = 0
stop = 1
ans = [1j] * q
T = (sorted(STXlist, key=lambda x: x[1],reverse=True))  
Tmax = T[0][2]

while True:
    time += 1
    D = list(map(lambda x:x+1 , D))

    for STX in STXlist:
        if time >= STX[0] and time < STX[1]:
            if STX[2] in D:
                stop += 1
                ans[D.index(STX[2])] = D[D.index(STX[2])]
                D[D.index(STX[2])] = (1 + 1j)

    if stop == q:
        for i in ans:
            print(i)
        break
    
    if time > Tmax + 10:
        indexes = [i for i, x in enumerate(ans) if x == 1j]
        for i in indexes:
            ans[ans.index(1j)] = -1
        for i in ans:
            print(i)
        break
