import sys
import bisect
 
N, Q = map(int, input().split(' '))
G = [list(map(int, sys.stdin.readline().split(' '))) for _ in range(N)]
T = [int(sys.stdin.readline()) for _ in range(Q)]

class SegTree :
    def __init__(self, n) :
        self.n = n
        self.A = [10**15] * (2 << (n + 1).bit_length())
 
    def update(self, l, r, val) :
      l += len(self.A) // 2
      r += len(self.A) // 2
      while l < r:
          if l & 1 :
              self.A[l] = min(self.A[l], val)
              l += 1
          if r & 1:
              self.A[r-1] = min(self.A[r-1], val)
              r -= 1
          l //= 2
          r //= 2

    def get(self, i) :
      i += len(self.A) // 2
      ret = self.A[i]
      while i > 0 :
          i //= 2
          ret = min(ret, self.A[i])
      return ret if ret < 10**15 else -1

ST = SegTree(Q)
for g in G :
    s = g[0] - g[2]
    e = g[1] - g[2]
 
    ll = bisect.bisect_left(T, s)
    rr = bisect.bisect_left(T, e)
 
    if ll == rr :
        continue
 
    ST.update(ll, rr, g[2])
 
for i in range(Q) :
    ans = ST.get(i)
    print(ans) import sys sys import bisect bisect N, Q = map(int, input().split(' ')) N map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' Q list(map(int, sys.stdin.readline().split(' '))) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, sys.stdin.readline().split(' '))) list map(int, sys.stdin.readline().split(' ')) map int sys.stdin.readline().split(' ') sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split ' ' G = [list(map(int, sys.stdin.readline().split(' '))) for _ in range(N)] G [list(map(int, sys.stdin.readline().split(' '))) for _ in range(N)] int(sys.stdin.readline()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline T = [int(sys.stdin.readline()) for _ in range(Q)] T [int(sys.stdin.readline()) for _ in range(Q)] class SegTree :
    def __init__(self, n) :
        self.n = n
        self.A = [10**15] * (2 << (n + 1).bit_length())
 
    def update(self, l, r, val) :
      l += len(self.A) // 2
      r += len(self.A) // 2
      while l < r:
          if l & 1 :
              self.A[l] = min(self.A[l], val)
              l += 1
          if r & 1:
              self.A[r-1] = min(self.A[r-1], val)
              r -= 1
          l //= 2
          r //= 2

    def get(self, i) :
      i += len(self.A) // 2
      ret = self.A[i]
      while i > 0 :
          i //= 2
          ret = min(ret, self.A[i])
      return ret if ret < 10**15 else -1 SegTree def __init__(self, n) :
        self.n = n
        self.A = [10**15] * (2 << (n + 1).bit_length())
 
     __init__ self.n = n self.n self n n self.A = [10**15] * (2 << (n + 1).bit_length()) self.A self A [10**15] * (2 << (n + 1).bit_length()) [10**15] 10**15 10 15 2 << (n + 1).bit_length() 2 (n + 1).bit_length() n + 1).bit_length n + 1 n 1 bit_length self self n n def update(self, l, r, val) :
      l += len(self.A) // 2
      r += len(self.A) // 2
      while l < r:
          if l & 1 :
              self.A[l] = min(self.A[l], val)
              l += 1
          if r & 1:
              self.A[r-1] = min(self.A[r-1], val)
              r -= 1
          l //= 2
          r //= 2

     update l += len(self.A) // 2 l len(self.A) // 2 len(self.A) len self.A self A 2 r += len(self.A) // 2 r len(self.A) // 2 len(self.A) len self.A self A 2 while l < r:
          if l & 1 :
              self.A[l] = min(self.A[l], val)
              l += 1
          if r & 1:
              self.A[r-1] = min(self.A[r-1], val)
              r -= 1
          l //= 2
          r //= 2

     l < r l r if l & 1 :
              self.A[l] = min(self.A[l], val)
              l += 1
           l & 1 l 1 self.A[l] = min(self.A[l], val) self.A[l] self.A self A l min(self.A[l], val) min self.A[l] self.A self A l val l += 1 l 1 if r & 1:
              self.A[r-1] = min(self.A[r-1], val)
              r -= 1
           r & 1 r 1 self.A[r-1] = min(self.A[r-1], val) self.A[r-1] self.A self A r-1 r 1 min(self.A[r-1], val) min self.A[r-1] self.A self A r-1 r 1 val r -= 1 r 1 l //= 2 l 2 r //= 2 r 2 self self l l r r val val def get(self, i) :
      i += len(self.A) // 2
      ret = self.A[i]
      while i > 0 :
          i //= 2
          ret = min(ret, self.A[i])
      return ret if ret < 10**15 else -1 get i += len(self.A) // 2 i len(self.A) // 2 len(self.A) len self.A self A 2 ret = self.A[i] ret self.A[i] self.A self A i while i > 0 :
          i //= 2
          ret = min(ret, self.A[i])
       i > 0 i 0 i //= 2 i 2 ret = min(ret, self.A[i]) ret min(ret, self.A[i]) min ret self.A[i] self.A self A i return ret if ret < 10**15 else -1 ret if ret < 10**15 else -1 ret < 10**15 ret 10**15 10 15 ret -1 self self i i ST = SegTree(Q) ST SegTree(Q) SegTree Q for g in G :
    s = g[0] - g[2]
    e = g[1] - g[2]
 
    ll = bisect.bisect_left(T, s)
    rr = bisect.bisect_left(T, e)
 
    if ll == rr :
        continue
 
    ST.update(ll, rr, g[2])
  g G s = g[0] - g[2] s g[0] - g[2] g[0] g 0 g[2] g 2 e = g[1] - g[2] e g[1] - g[2] g[1] g 1 g[2] g 2 ll = bisect.bisect_left(T, s) ll bisect.bisect_left(T, s) bisect.bisect_left bisect bisect_left T s rr = bisect.bisect_left(T, e) rr bisect.bisect_left(T, e) bisect.bisect_left bisect bisect_left T e if ll == rr :
        continue
 
     ll == rr ll rr continue ST.update(ll, rr, g[2]) ST.update ST update ll rr g[2] g 2 for i in range(Q) :
    ans = ST.get(i)
    print(ans) i range(Q) range Q ans = ST.get(i) ans ST.get(i) ST.get ST get i print(ans) print ans T = [int(sys.stdin.readline()) for _ in range(Q)] [int(sys.stdin.readline()) for _ in range(Q)] T rr = bisect.bisect_left(T, e) bisect.bisect_left(T, e) rr ST = SegTree(Q) SegTree(Q) ST ans = ST.get(i) ST.get(i) ans N, Q = map(int, input().split(' ')) map(int, input().split(' ')) N ll = bisect.bisect_left(T, s) bisect.bisect_left(T, s) ll G = [list(map(int, sys.stdin.readline().split(' '))) for _ in range(N)] [list(map(int, sys.stdin.readline().split(' '))) for _ in range(N)] G e = g[1] - g[2] g[1] - g[2] e s = g[0] - g[2] g[0] - g[2] s Q = map(int, input().split(' ')) map(int, input().split(' ')) Q class SegTree :
    def __init__(self, n) :
        self.n = n
        self.A = [10**15] * (2 << (n + 1).bit_length())
 
    def update(self, l, r, val) :
      l += len(self.A) // 2
      r += len(self.A) // 2
      while l < r:
          if l & 1 :
              self.A[l] = min(self.A[l], val)
              l += 1
          if r & 1:
              self.A[r-1] = min(self.A[r-1], val)
              r -= 1
          l //= 2
          r //= 2

    def get(self, i) :
      i += len(self.A) // 2
      ret = self.A[i]
      while i > 0 :
          i //= 2
          ret = min(ret, self.A[i])
      return ret if ret < 10**15 else -1 class SegTree :
    def __init__(self, n) :
        self.n = n
        self.A = [10**15] * (2 << (n + 1).bit_length())
 
    def update(self, l, r, val) :
      l += len(self.A) // 2
      r += len(self.A) // 2
      while l < r:
          if l & 1 :
              self.A[l] = min(self.A[l], val)
              l += 1
          if r & 1:
              self.A[r-1] = min(self.A[r-1], val)
              r -= 1
          l //= 2
          r //= 2

    def get(self, i) :
      i += len(self.A) // 2
      ret = self.A[i]
      while i > 0 :
          i //= 2
          ret = min(ret, self.A[i])
      return ret if ret < 10**15 else -1 SegTree
import sys
import bisect
 
N, Q = map(int, input().split(' '))
G = [list(map(int, sys.stdin.readline().split(' '))) for _ in range(N)]
T = [int(sys.stdin.readline()) for _ in range(Q)]

class SegTree :
    def __init__(self, n) :
        self.n = n
        self.A = [10**15] * (2 << (n + 1).bit_length())
 
    def update(self, l, r, val) :
      l += len(self.A) // 2
      r += len(self.A) // 2
      while l < r:
          if l & 1 :
              self.A[l] = min(self.A[l], val)
              l += 1
          if r & 1:
              self.A[r-1] = min(self.A[r-1], val)
              r -= 1
          l //= 2
          r //= 2

    def get(self, i) :
      i += len(self.A) // 2
      ret = self.A[i]
      while i > 0 :
          i //= 2
          ret = min(ret, self.A[i])
      return ret if ret < 10**15 else -1

ST = SegTree(Q)
for g in G :
    s = g[0] - g[2]
    e = g[1] - g[2]
 
    ll = bisect.bisect_left(T, s)
    rr = bisect.bisect_left(T, e)
 
    if ll == rr :
        continue
 
    ST.update(ll, rr, g[2])
 
for i in range(Q) :
    ans = ST.get(i)
    print(ans)
