# instead of AVLTree
class BITbisect():
    def __init__(self, max):
        self.max = max
        self.data = [0]*(self.max+1)
    
    # 0からiまでの区間和
    # 立っているビットを下から処理
    def query_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # i番目の要素にxを足す
    # 覆ってる区間すべてに足す
    def add(self, i, x):
        while i <= self.max:
            self.data[i] += x
            i += i & -i

    def insert(self, x):
        self.add(x, 1)

    def delete(self, x):
        self.add(x, -1)

    def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)
    
    def length(self):
        return self.query_sum(self.max)
    
    # 下からc番目(0-indexed)の数
    # O(log(N))
    def search(self, c):
        c += 1
        s = 0
        ind = 0
        l = self.max.bit_length()
        for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
        if ind == self.max:
            return False
        return ind + 1
    
    def bisect_right(self, x):
        return self.query_sum(x)

    def bisect_left(self, x):
        if x == 1:
            return 0
        return self.query_sum(x-1)

    # listみたいに表示
    def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print()

from bisect import bisect_left, bisect_right
from operator import itemgetter
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]

bit = BITbisect(Q+1)

for i, d in enumerate(D):
    bit.insert(i+1)

STX.sort(key=itemgetter(2))

ans = [-1]*Q
for s, t, x in STX:
    #print(s, t, x)
    #bit.display()
    il = bisect_left(D, s-x)
    ir = bisect_right(D, t-x-1)
    #print(il, ir)
    ind_l = bit.bisect_right(il)
    ind_r = bit.bisect_right(ir)
    #print(ind_l, ind_r)
    for ind in range(ind_l, ind_r):
        il = bit.search(ind_l)
        bit.delete(il)
        ans[il-1] = x


for a in ans:
    print(a) class BITbisect():
    def __init__(self, max):
        self.max = max
        self.data = [0]*(self.max+1)
    
    # 0からiまでの区間和
    # 立っているビットを下から処理
    def query_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # i番目の要素にxを足す
    # 覆ってる区間すべてに足す
    def add(self, i, x):
        while i <= self.max:
            self.data[i] += x
            i += i & -i

    def insert(self, x):
        self.add(x, 1)

    def delete(self, x):
        self.add(x, -1)

    def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)
    
    def length(self):
        return self.query_sum(self.max)
    
    # 下からc番目(0-indexed)の数
    # O(log(N))
    def search(self, c):
        c += 1
        s = 0
        ind = 0
        l = self.max.bit_length()
        for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
        if ind == self.max:
            return False
        return ind + 1
    
    def bisect_right(self, x):
        return self.query_sum(x)

    def bisect_left(self, x):
        if x == 1:
            return 0
        return self.query_sum(x-1)

    # listみたいに表示
    def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print() BITbisect def __init__(self, max):
        self.max = max
        self.data = [0]*(self.max+1)
    
    # 0からiまでの区間和
    # 立っているビットを下から処理
     __init__ self.max = max self.max self max max self.data = [0]*(self.max+1) self.data self data [0]*(self.max+1) [0] 0 self.max+1 self.max self max 1 self self max max def query_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # i番目の要素にxを足す
    # 覆ってる区間すべてに足す
     query_sum s = 0 s 0 while i > 0:
            s += self.data[i]
            i -= i & -i
         i > 0 i 0 s += self.data[i] s self.data[i] self.data self data 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.max:
            self.data[i] += x
            i += i & -i

     add while i <= self.max:
            self.data[i] += x
            i += i & -i

     i <= self.max i self.max self max self.data[i] += x self.data[i] self.data self data i x i += i & -i i i & -i i -i i self self i i x x def insert(self, x):
        self.add(x, 1)

     insert self.add(x, 1) self.add self add x 1 self self x x def delete(self, x):
        self.add(x, -1)

     delete self.add(x, -1) self.add self add x -1 self self x x def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)
    
     count return self.query_sum(x) - self.query_sum(x-1) self.query_sum(x) - self.query_sum(x-1) self.query_sum(x) self.query_sum self query_sum x self.query_sum(x-1) self.query_sum self query_sum x-1 x 1 self self x x def length(self):
        return self.query_sum(self.max)
    
    # 下からc番目(0-indexed)の数
    # O(log(N))
     length return self.query_sum(self.max) self.query_sum(self.max) self.query_sum self query_sum self.max self max self self def search(self, c):
        c += 1
        s = 0
        ind = 0
        l = self.max.bit_length()
        for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
        if ind == self.max:
            return False
        return ind + 1
    
     search c += 1 c 1 s = 0 s 0 ind = 0 ind 0 l = self.max.bit_length() l self.max.bit_length() self.max.bit_length self.max self max bit_length for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
         i reversed(range(l)) reversed range(l) range l if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
         ind + (1<<i) <= self.max ind + (1<<i) ind 1<<i 1 i self.max self max if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
         s + self.data[ind+(1<<i)] < c s + self.data[ind+(1<<i)] s self.data[ind+(1<<i)] self.data self data ind+(1<<i) ind 1<<i 1 i c s += self.data[ind+(1<<i)] s self.data[ind+(1<<i)] self.data self data ind+(1<<i) ind 1<<i 1 i ind += (1<<i) ind 1<<i 1 i if ind == self.max:
            return False
         ind == self.max ind self.max self max return False False return ind + 1 ind + 1 ind 1 self self c c def bisect_right(self, x):
        return self.query_sum(x)

     bisect_right return self.query_sum(x) self.query_sum(x) self.query_sum self query_sum x self self x x def bisect_left(self, x):
        if x == 1:
            return 0
        return self.query_sum(x-1)

    # listみたいに表示
     bisect_left if x == 1:
            return 0
         x == 1 x 1 return 0 0 return self.query_sum(x-1) self.query_sum(x-1) self.query_sum self query_sum x-1 x 1 self self x x def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print() display print('inside BIT:', end=' ') print 'inside BIT:' end=' ' end ' ' for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
         x range(1, self.max+1) range 1 self.max+1 self.max self max 1 if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
         self.count(x) self.count self count x c = self.count(x) c self.count(x) self.count self count x for _ in range(c):
                    print(x, end=' ')
         _ range(c) range c print(x, end=' ') print x end=' ' end ' ' print() print self self from bisect import bisect_left, bisect_right from operator import itemgetter import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N, Q = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split Q list(map(int, input().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split STX = [list(map(int, input().split())) for _ in range(N)] STX [list(map(int, input().split())) for _ in range(N)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input D = [int(input()) for _ in range(Q)] D [int(input()) for _ in range(Q)] bit = BITbisect(Q+1) bit BITbisect(Q+1) BITbisect Q+1 Q 1 for i, d in enumerate(D):
    bit.insert(i+1) i d enumerate(D) enumerate D bit.insert(i+1) bit.insert bit insert i+1 i 1 STX.sort(key=itemgetter(2)) STX.sort STX sort key=itemgetter(2) key itemgetter(2) itemgetter 2 ans = [-1]*Q ans [-1]*Q [-1] -1 Q for s, t, x in STX:
    #print(s, t, x)
    #bit.display()
    il = bisect_left(D, s-x)
    ir = bisect_right(D, t-x-1)
    #print(il, ir)
    ind_l = bit.bisect_right(il)
    ind_r = bit.bisect_right(ir)
    #print(ind_l, ind_r)
    for ind in range(ind_l, ind_r):
        il = bit.search(ind_l)
        bit.delete(il)
        ans[il-1] = x s t x STX il = bisect_left(D, s-x) il bisect_left(D, s-x) bisect_left D s-x s x ir = bisect_right(D, t-x-1) ir bisect_right(D, t-x-1) bisect_right D t-x-1 t-x t x 1 ind_l = bit.bisect_right(il) ind_l bit.bisect_right(il) bit.bisect_right bit bisect_right il ind_r = bit.bisect_right(ir) ind_r bit.bisect_right(ir) bit.bisect_right bit bisect_right ir for ind in range(ind_l, ind_r):
        il = bit.search(ind_l)
        bit.delete(il)
        ans[il-1] = x ind range(ind_l, ind_r) range ind_l ind_r il = bit.search(ind_l) il bit.search(ind_l) bit.search bit search ind_l bit.delete(il) bit.delete bit delete il ans[il-1] = x ans[il-1] ans il-1 il 1 x for a in ans:
    print(a) a ans print(a) print a N, Q = map(int, input().split()) map(int, input().split()) N Q = map(int, input().split()) map(int, input().split()) Q D = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] D STX = [list(map(int, input().split())) for _ in range(N)] [list(map(int, input().split())) for _ in range(N)] STX ind_r = bit.bisect_right(ir) bit.bisect_right(ir) ind_r il = bisect_left(D, s-x) bisect_left(D, s-x) il bit = BITbisect(Q+1) BITbisect(Q+1) bit ans = [-1]*Q [-1]*Q ans input = sys.stdin.readline sys.stdin.readline input ind_l = bit.bisect_right(il) bit.bisect_right(il) ind_l class BITbisect():
    def __init__(self, max):
        self.max = max
        self.data = [0]*(self.max+1)
    
    # 0からiまでの区間和
    # 立っているビットを下から処理
    def query_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # i番目の要素にxを足す
    # 覆ってる区間すべてに足す
    def add(self, i, x):
        while i <= self.max:
            self.data[i] += x
            i += i & -i

    def insert(self, x):
        self.add(x, 1)

    def delete(self, x):
        self.add(x, -1)

    def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)
    
    def length(self):
        return self.query_sum(self.max)
    
    # 下からc番目(0-indexed)の数
    # O(log(N))
    def search(self, c):
        c += 1
        s = 0
        ind = 0
        l = self.max.bit_length()
        for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
        if ind == self.max:
            return False
        return ind + 1
    
    def bisect_right(self, x):
        return self.query_sum(x)

    def bisect_left(self, x):
        if x == 1:
            return 0
        return self.query_sum(x-1)

    # listみたいに表示
    def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print() class BITbisect():
    def __init__(self, max):
        self.max = max
        self.data = [0]*(self.max+1)
    
    # 0からiまでの区間和
    # 立っているビットを下から処理
    def query_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # i番目の要素にxを足す
    # 覆ってる区間すべてに足す
    def add(self, i, x):
        while i <= self.max:
            self.data[i] += x
            i += i & -i

    def insert(self, x):
        self.add(x, 1)

    def delete(self, x):
        self.add(x, -1)

    def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)
    
    def length(self):
        return self.query_sum(self.max)
    
    # 下からc番目(0-indexed)の数
    # O(log(N))
    def search(self, c):
        c += 1
        s = 0
        ind = 0
        l = self.max.bit_length()
        for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
        if ind == self.max:
            return False
        return ind + 1
    
    def bisect_right(self, x):
        return self.query_sum(x)

    def bisect_left(self, x):
        if x == 1:
            return 0
        return self.query_sum(x-1)

    # listみたいに表示
    def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print() BITbisect ir = bisect_right(D, t-x-1) bisect_right(D, t-x-1) ir il = bit.search(ind_l) bit.search(ind_l) il
# instead of AVLTree
class BITbisect():
    def __init__(self, max):
        self.max = max
        self.data = [0]*(self.max+1)
    
    # 0からiまでの区間和
    # 立っているビットを下から処理
    def query_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # i番目の要素にxを足す
    # 覆ってる区間すべてに足す
    def add(self, i, x):
        while i <= self.max:
            self.data[i] += x
            i += i & -i

    def insert(self, x):
        self.add(x, 1)

    def delete(self, x):
        self.add(x, -1)

    def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)
    
    def length(self):
        return self.query_sum(self.max)
    
    # 下からc番目(0-indexed)の数
    # O(log(N))
    def search(self, c):
        c += 1
        s = 0
        ind = 0
        l = self.max.bit_length()
        for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
        if ind == self.max:
            return False
        return ind + 1
    
    def bisect_right(self, x):
        return self.query_sum(x)

    def bisect_left(self, x):
        if x == 1:
            return 0
        return self.query_sum(x-1)

    # listみたいに表示
    def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print()

from bisect import bisect_left, bisect_right
from operator import itemgetter
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
STX = [list(map(int, input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]

bit = BITbisect(Q+1)

for i, d in enumerate(D):
    bit.insert(i+1)

STX.sort(key=itemgetter(2))

ans = [-1]*Q
for s, t, x in STX:
    #print(s, t, x)
    #bit.display()
    il = bisect_left(D, s-x)
    ir = bisect_right(D, t-x-1)
    #print(il, ir)
    ind_l = bit.bisect_right(il)
    ind_r = bit.bisect_right(ir)
    #print(ind_l, ind_r)
    for ind in range(ind_l, ind_r):
        il = bit.search(ind_l)
        bit.delete(il)
        ans[il-1] = x


for a in ans:
    print(a)