import sys
input = sys.stdin.buffer.readline


class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    # i+1番目からR番目まで足すとt以上となるような最小のRを返す
    def bisect_plus(self, i, t):
        L = i
        R = self.size
        R_prev = R
        sum_i = self.sum(i)
        while True:
            range_sum = self.sum(R) - sum_i
            if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
    def bisect_minus(self, i, t):
        L = 1
        R = i
        L_prev = L
        sum_i = self.sum(i - 1)
        while True:
            range_sum = sum_i - self.sum(L - 1)
            if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L


def main():
    N, Q = map(int, input().split())
    ev = []
    x_list = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        ev.append([s-x, 1, x])
        ev.append([t-x, -1, x])
        x_list.append(x)
    for _ in range(Q):
        d = int(input())
        ev.append([d, 0, 0])
    ev.sort(key=lambda p: p[0])
    x_list.sort()
    x_idx = {}
    for i in range(1, N+1):
        x_idx[x_list[i-1]] = i

    bit = Bit(N)
    x_list.append(-1)
    for pos, flag, x in ev:
        if flag == 0:
            print(x_list[bit.bisect_plus(0, 1) - 1])
        else:
            idx = x_idx[x]
            bit.add(idx, flag)


if __name__ == '__main__':
    main() import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    # i+1番目からR番目まで足すとt以上となるような最小のRを返す
    def bisect_plus(self, i, t):
        L = i
        R = self.size
        R_prev = R
        sum_i = self.sum(i)
        while True:
            range_sum = self.sum(R) - sum_i
            if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
    def bisect_minus(self, i, t):
        L = 1
        R = i
        L_prev = L
        sum_i = self.sum(i - 1)
        while True:
            range_sum = sum_i - self.sum(L - 1)
            if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L Bit def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

     __init__ self.size = n self.size self size n self.tree = [0] * (n + 1) self.tree self tree [0] * (n + 1) [0] 0 n + 1 n 1 self self n n def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

     sum s = 0 s 0 while i > 0:
            s += self.tree[i]
            i -= i & -i
         i > 0 i 0 s += self.tree[i] s self.tree[i] self.tree self tree i i -= i & -i i i & -i i -i i return s s self self i i def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    # i+1番目からR番目まで足すとt以上となるような最小のRを返す
     add while i <= self.size:
            self.tree[i] += x
            i += i & -i

    # i+1番目からR番目まで足すとt以上となるような最小のRを返す
     i <= self.size i self.size self size self.tree[i] += x self.tree[i] self.tree self tree i x i += i & -i i i & -i i -i i self self i i x x def bisect_plus(self, i, t):
        L = i
        R = self.size
        R_prev = R
        sum_i = self.sum(i)
        while True:
            range_sum = self.sum(R) - sum_i
            if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
     bisect_plus L = i L i R = self.size R self.size self size R_prev = R R_prev R sum_i = self.sum(i) sum_i self.sum(i) self.sum self sum i while True:
            range_sum = self.sum(R) - sum_i
            if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
     True range_sum = self.sum(R) - sum_i range_sum self.sum(R) - sum_i self.sum(R) self.sum self sum R sum_i if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
     range_sum < t range_sum t if R == self.size:
                    return self.size + 1
                 R == self.size R self.size self size return self.size + 1 self.size + 1 self.size self size 1 L, R = R, R_prev L R R R_prev R_prev = R R_prev R R = (L + R + 1) // 2 R (L + R + 1) // 2 L + R + 1 L + R L R 1 2 if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
     R == R_prev R R_prev return R R self self i i t t def bisect_minus(self, i, t):
        L = 1
        R = i
        L_prev = L
        sum_i = self.sum(i - 1)
        while True:
            range_sum = sum_i - self.sum(L - 1)
            if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L bisect_minus L = 1 L 1 R = i R i L_prev = L L_prev L sum_i = self.sum(i - 1) sum_i self.sum(i - 1) self.sum self sum i - 1 i 1 while True:
            range_sum = sum_i - self.sum(L - 1)
            if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L True range_sum = sum_i - self.sum(L - 1) range_sum sum_i - self.sum(L - 1) sum_i self.sum(L - 1) self.sum self sum L - 1 L 1 if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L range_sum < t range_sum t if L == 1:
                    return 0
                 L == 1 L 1 return 0 0 L, R = L_prev, L L L_prev R L L_prev = L L_prev L L = (L + R) // 2 L (L + R) // 2 L + R L R 2 if L == L_prev:
                    return L L == L_prev L L_prev return L L self self i i t t def main():
    N, Q = map(int, input().split())
    ev = []
    x_list = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        ev.append([s-x, 1, x])
        ev.append([t-x, -1, x])
        x_list.append(x)
    for _ in range(Q):
        d = int(input())
        ev.append([d, 0, 0])
    ev.sort(key=lambda p: p[0])
    x_list.sort()
    x_idx = {}
    for i in range(1, N+1):
        x_idx[x_list[i-1]] = i

    bit = Bit(N)
    x_list.append(-1)
    for pos, flag, x in ev:
        if flag == 0:
            print(x_list[bit.bisect_plus(0, 1) - 1])
        else:
            idx = x_idx[x]
            bit.add(idx, flag) main N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q ev = [] ev [] x_list = [] x_list [] for _ in range(N):
        s, t, x = map(int, input().split())
        ev.append([s-x, 1, x])
        ev.append([t-x, -1, x])
        x_list.append(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 ev.append([s-x, 1, x]) ev.append ev append [s-x, 1, x] s-x s x 1 x ev.append([t-x, -1, x]) ev.append ev append [t-x, -1, x] t-x t x -1 x x_list.append(x) x_list.append x_list append x for _ in range(Q):
        d = int(input())
        ev.append([d, 0, 0])
     _ range(Q) range Q d = int(input()) d int(input()) int input() input ev.append([d, 0, 0]) ev.append ev append [d, 0, 0] d 0 0 ev.sort(key=lambda p: p[0]) ev.sort ev sort key=lambda p: p[0] key lambda p: p[0] p[0] p 0 p x_list.sort() x_list.sort x_list sort x_idx = {} x_idx {} for i in range(1, N+1):
        x_idx[x_list[i-1]] = i

     i range(1, N+1) range 1 N+1 N 1 x_idx[x_list[i-1]] = i x_idx[x_list[i-1]] x_idx x_list[i-1] x_list i-1 i 1 i bit = Bit(N) bit Bit(N) Bit N x_list.append(-1) x_list.append x_list append -1 for pos, flag, x in ev:
        if flag == 0:
            print(x_list[bit.bisect_plus(0, 1) - 1])
        else:
            idx = x_idx[x]
            bit.add(idx, flag) pos flag x ev if flag == 0:
            print(x_list[bit.bisect_plus(0, 1) - 1])
        else:
            idx = x_idx[x]
            bit.add(idx, flag) flag == 0 flag 0 print(x_list[bit.bisect_plus(0, 1) - 1]) print x_list[bit.bisect_plus(0, 1) - 1] x_list bit.bisect_plus(0, 1) - 1 bit.bisect_plus(0, 1) bit.bisect_plus bit bisect_plus 0 1 1 idx = x_idx[x] idx x_idx[x] x_idx x bit.add(idx, flag) bit.add bit add idx flag if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main input = sys.stdin.buffer.readline sys.stdin.buffer.readline input class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    # i+1番目からR番目まで足すとt以上となるような最小のRを返す
    def bisect_plus(self, i, t):
        L = i
        R = self.size
        R_prev = R
        sum_i = self.sum(i)
        while True:
            range_sum = self.sum(R) - sum_i
            if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
    def bisect_minus(self, i, t):
        L = 1
        R = i
        L_prev = L
        sum_i = self.sum(i - 1)
        while True:
            range_sum = sum_i - self.sum(L - 1)
            if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    # i+1番目からR番目まで足すとt以上となるような最小のRを返す
    def bisect_plus(self, i, t):
        L = i
        R = self.size
        R_prev = R
        sum_i = self.sum(i)
        while True:
            range_sum = self.sum(R) - sum_i
            if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
    def bisect_minus(self, i, t):
        L = 1
        R = i
        L_prev = L
        sum_i = self.sum(i - 1)
        while True:
            range_sum = sum_i - self.sum(L - 1)
            if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L Bit def main():
    N, Q = map(int, input().split())
    ev = []
    x_list = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        ev.append([s-x, 1, x])
        ev.append([t-x, -1, x])
        x_list.append(x)
    for _ in range(Q):
        d = int(input())
        ev.append([d, 0, 0])
    ev.sort(key=lambda p: p[0])
    x_list.sort()
    x_idx = {}
    for i in range(1, N+1):
        x_idx[x_list[i-1]] = i

    bit = Bit(N)
    x_list.append(-1)
    for pos, flag, x in ev:
        if flag == 0:
            print(x_list[bit.bisect_plus(0, 1) - 1])
        else:
            idx = x_idx[x]
            bit.add(idx, flag) def main():
    N, Q = map(int, input().split())
    ev = []
    x_list = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        ev.append([s-x, 1, x])
        ev.append([t-x, -1, x])
        x_list.append(x)
    for _ in range(Q):
        d = int(input())
        ev.append([d, 0, 0])
    ev.sort(key=lambda p: p[0])
    x_list.sort()
    x_idx = {}
    for i in range(1, N+1):
        x_idx[x_list[i-1]] = i

    bit = Bit(N)
    x_list.append(-1)
    for pos, flag, x in ev:
        if flag == 0:
            print(x_list[bit.bisect_plus(0, 1) - 1])
        else:
            idx = x_idx[x]
            bit.add(idx, flag) main
import sys
input = sys.stdin.buffer.readline


class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    # i+1番目からR番目まで足すとt以上となるような最小のRを返す
    def bisect_plus(self, i, t):
        L = i
        R = self.size
        R_prev = R
        sum_i = self.sum(i)
        while True:
            range_sum = self.sum(R) - sum_i
            if range_sum < t:
                if R == self.size:
                    return self.size + 1
                L, R = R, R_prev
            else:
                R_prev = R
                R = (L + R + 1) // 2
                if R == R_prev:
                    return R

    # L番目からi-1番目まで足すとt以上となるような最小のRを返す
    def bisect_minus(self, i, t):
        L = 1
        R = i
        L_prev = L
        sum_i = self.sum(i - 1)
        while True:
            range_sum = sum_i - self.sum(L - 1)
            if range_sum < t:
                if L == 1:
                    return 0
                L, R = L_prev, L
            else:
                L_prev = L
                L = (L + R) // 2
                if L == L_prev:
                    return L


def main():
    N, Q = map(int, input().split())
    ev = []
    x_list = []
    for _ in range(N):
        s, t, x = map(int, input().split())
        ev.append([s-x, 1, x])
        ev.append([t-x, -1, x])
        x_list.append(x)
    for _ in range(Q):
        d = int(input())
        ev.append([d, 0, 0])
    ev.sort(key=lambda p: p[0])
    x_list.sort()
    x_idx = {}
    for i in range(1, N+1):
        x_idx[x_list[i-1]] = i

    bit = Bit(N)
    x_list.append(-1)
    for pos, flag, x in ev:
        if flag == 0:
            print(x_list[bit.bisect_plus(0, 1) - 1])
        else:
            idx = x_idx[x]
            bit.add(idx, flag)


if __name__ == '__main__':
    main()
