import sys
from bisect import *

input = sys.stdin.readline

def f(n, q):
    xst = []
    for i in range(n):
        s, t, x = map(int, input().split())
        xst.append([x, s - x, t - x])
    xst.sort()

    ds = []
    for i in range(q):
        d = int(input())
        ds.append(d)

    ans = [-1] * q
    jump = [-1] * q

    for x, s, t in xst:
        i = bisect_left(ds, s)
        fi = bisect_left(ds, t)
        while i < fi:
            if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

    print(*ans, sep="\n")

n, q = map(int, input().split())
f(n, q) import sys sys from bisect import * input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def f(n, q):
    xst = []
    for i in range(n):
        s, t, x = map(int, input().split())
        xst.append([x, s - x, t - x])
    xst.sort()

    ds = []
    for i in range(q):
        d = int(input())
        ds.append(d)

    ans = [-1] * q
    jump = [-1] * q

    for x, s, t in xst:
        i = bisect_left(ds, s)
        fi = bisect_left(ds, t)
        while i < fi:
            if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

    print(*ans, sep="\n") f xst = [] xst [] for i in range(n):
        s, t, x = map(int, input().split())
        xst.append([x, s - x, t - x])
     i 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 xst.append([x, s - x, t - x]) xst.append xst append [x, s - x, t - x] x s - x s x t - x t x xst.sort() xst.sort xst sort ds = [] ds [] for i in range(q):
        d = int(input())
        ds.append(d)

     i range(q) range q d = int(input()) d int(input()) int input() input ds.append(d) ds.append ds append d ans = [-1] * q ans [-1] * q [-1] -1 q jump = [-1] * q jump [-1] * q [-1] -1 q for x, s, t in xst:
        i = bisect_left(ds, s)
        fi = bisect_left(ds, t)
        while i < fi:
            if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

     x s t xst i = bisect_left(ds, s) i bisect_left(ds, s) bisect_left ds s fi = bisect_left(ds, t) fi bisect_left(ds, t) bisect_left ds t while i < fi:
            if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

     i < fi i fi if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

     jump[i] != -1 jump[i] jump i -1 i = jump[i] i jump[i] jump i ans[i] = x ans[i] ans i x jump[i] = fi jump[i] jump i fi i += 1 i 1 print(*ans, sep="\n") print *ans ans sep="\n" sep "\n" n n q q n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q f(n, q) f n q def f(n, q):
    xst = []
    for i in range(n):
        s, t, x = map(int, input().split())
        xst.append([x, s - x, t - x])
    xst.sort()

    ds = []
    for i in range(q):
        d = int(input())
        ds.append(d)

    ans = [-1] * q
    jump = [-1] * q

    for x, s, t in xst:
        i = bisect_left(ds, s)
        fi = bisect_left(ds, t)
        while i < fi:
            if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

    print(*ans, sep="\n") def f(n, q):
    xst = []
    for i in range(n):
        s, t, x = map(int, input().split())
        xst.append([x, s - x, t - x])
    xst.sort()

    ds = []
    for i in range(q):
        d = int(input())
        ds.append(d)

    ans = [-1] * q
    jump = [-1] * q

    for x, s, t in xst:
        i = bisect_left(ds, s)
        fi = bisect_left(ds, t)
        while i < fi:
            if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

    print(*ans, sep="\n") f input = sys.stdin.readline sys.stdin.readline input n, q = map(int, input().split()) map(int, input().split()) n q = map(int, input().split()) map(int, input().split()) q
import sys
from bisect import *

input = sys.stdin.readline

def f(n, q):
    xst = []
    for i in range(n):
        s, t, x = map(int, input().split())
        xst.append([x, s - x, t - x])
    xst.sort()

    ds = []
    for i in range(q):
        d = int(input())
        ds.append(d)

    ans = [-1] * q
    jump = [-1] * q

    for x, s, t in xst:
        i = bisect_left(ds, s)
        fi = bisect_left(ds, t)
        while i < fi:
            if jump[i] != -1:
                i = jump[i]
            else:
                ans[i] = x
                jump[i] = fi
                i += 1

    print(*ans, sep="\n")

n, q = map(int, input().split())
f(n, q)
