import sys
input = sys.stdin.readline

def bs(d, x):
  l, r = 0, len(d)
  while l < r:
    mid = (l + r) // 2
    if d[mid] < x:
      l = mid + 1
    else:
      r = mid
  return l


def main():
  n, q = map(int, input().split())
  stx = [tuple(map(int, input().split())) for _ in range(n)]
  stx = list(sorted(stx, key=lambda x: x[2]))
  dlist = [int(input()) for _ in range(q)]
  ans = [-1 for _ in range(q)]
  skip = [-1 for _ in range(q)]
  for s, t, x in stx:
    l = bs(dlist, s-x)
    r = bs(dlist, t-x)
    while l < r:
      if skip[l] == -1:
        ans[l] = x
        skip[l] = r
        l += 1
      else:
        l = skip[l]
  print(*ans, sep='\n')


if __name__ == '__main__':
  main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def bs(d, x):
  l, r = 0, len(d)
  while l < r:
    mid = (l + r) // 2
    if d[mid] < x:
      l = mid + 1
    else:
      r = mid
  return l bs l, r = 0, len(d) l 0 r len(d) len d while l < r:
    mid = (l + r) // 2
    if d[mid] < x:
      l = mid + 1
    else:
      r = mid
   l < r l r mid = (l + r) // 2 mid (l + r) // 2 l + r l r 2 if d[mid] < x:
      l = mid + 1
    else:
      r = mid
   d[mid] < x d[mid] d mid x l = mid + 1 l mid + 1 mid 1 r = mid r mid return l l d d x x def main():
  n, q = map(int, input().split())
  stx = [tuple(map(int, input().split())) for _ in range(n)]
  stx = list(sorted(stx, key=lambda x: x[2]))
  dlist = [int(input()) for _ in range(q)]
  ans = [-1 for _ in range(q)]
  skip = [-1 for _ in range(q)]
  for s, t, x in stx:
    l = bs(dlist, s-x)
    r = bs(dlist, t-x)
    while l < r:
      if skip[l] == -1:
        ans[l] = x
        skip[l] = r
        l += 1
      else:
        l = skip[l]
  print(*ans, sep='\n') main n, q = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split q tuple(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split stx = [tuple(map(int, input().split())) for _ in range(n)] stx [tuple(map(int, input().split())) for _ in range(n)] stx = list(sorted(stx, key=lambda x: x[2])) stx list(sorted(stx, key=lambda x: x[2])) list sorted(stx, key=lambda x: x[2]) sorted stx key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x int(input()) for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(input()) int input() input dlist = [int(input()) for _ in range(q)] dlist [int(input()) for _ in range(q)] -1 for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) -1 ans = [-1 for _ in range(q)] ans [-1 for _ in range(q)] -1 for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) -1 skip = [-1 for _ in range(q)] skip [-1 for _ in range(q)] for s, t, x in stx:
    l = bs(dlist, s-x)
    r = bs(dlist, t-x)
    while l < r:
      if skip[l] == -1:
        ans[l] = x
        skip[l] = r
        l += 1
      else:
        l = skip[l]
   s t x stx l = bs(dlist, s-x) l bs(dlist, s-x) bs dlist s-x s x r = bs(dlist, t-x) r bs(dlist, t-x) bs dlist t-x t x while l < r:
      if skip[l] == -1:
        ans[l] = x
        skip[l] = r
        l += 1
      else:
        l = skip[l]
   l < r l r if skip[l] == -1:
        ans[l] = x
        skip[l] = r
        l += 1
      else:
        l = skip[l]
   skip[l] == -1 skip[l] skip l -1 ans[l] = x ans[l] ans l x skip[l] = r skip[l] skip l r l += 1 l 1 l = skip[l] l skip[l] skip l print(*ans, sep='\n') print *ans ans sep='\n' sep '\n' if __name__ == '__main__':
  main() __name__ == '__main__' __name__ '__main__' main() main input = sys.stdin.readline sys.stdin.readline input def main():
  n, q = map(int, input().split())
  stx = [tuple(map(int, input().split())) for _ in range(n)]
  stx = list(sorted(stx, key=lambda x: x[2]))
  dlist = [int(input()) for _ in range(q)]
  ans = [-1 for _ in range(q)]
  skip = [-1 for _ in range(q)]
  for s, t, x in stx:
    l = bs(dlist, s-x)
    r = bs(dlist, t-x)
    while l < r:
      if skip[l] == -1:
        ans[l] = x
        skip[l] = r
        l += 1
      else:
        l = skip[l]
  print(*ans, sep='\n') def main():
  n, q = map(int, input().split())
  stx = [tuple(map(int, input().split())) for _ in range(n)]
  stx = list(sorted(stx, key=lambda x: x[2]))
  dlist = [int(input()) for _ in range(q)]
  ans = [-1 for _ in range(q)]
  skip = [-1 for _ in range(q)]
  for s, t, x in stx:
    l = bs(dlist, s-x)
    r = bs(dlist, t-x)
    while l < r:
      if skip[l] == -1:
        ans[l] = x
        skip[l] = r
        l += 1
      else:
        l = skip[l]
  print(*ans, sep='\n') main def bs(d, x):
  l, r = 0, len(d)
  while l < r:
    mid = (l + r) // 2
    if d[mid] < x:
      l = mid + 1
    else:
      r = mid
  return l def bs(d, x):
  l, r = 0, len(d)
  while l < r:
    mid = (l + r) // 2
    if d[mid] < x:
      l = mid + 1
    else:
      r = mid
  return l bs
import sys
input = sys.stdin.readline

def bs(d, x):
  l, r = 0, len(d)
  while l < r:
    mid = (l + r) // 2
    if d[mid] < x:
      l = mid + 1
    else:
      r = mid
  return l


def main():
  n, q = map(int, input().split())
  stx = [tuple(map(int, input().split())) for _ in range(n)]
  stx = list(sorted(stx, key=lambda x: x[2]))
  dlist = [int(input()) for _ in range(q)]
  ans = [-1 for _ in range(q)]
  skip = [-1 for _ in range(q)]
  for s, t, x in stx:
    l = bs(dlist, s-x)
    r = bs(dlist, t-x)
    while l < r:
      if skip[l] == -1:
        ans[l] = x
        skip[l] = r
        l += 1
      else:
        l = skip[l]
  print(*ans, sep='\n')


if __name__ == '__main__':
  main()