type t =
  | Leaf
  | Node of body
and body = { left : t; right : t; data : int; l : int; r : int }

let rec drop n l =
  if n = 0 then l else drop (n - 1) (List.tl l)

let rec init l n xs =
  if n = 1
  then
    (Node
      { left = Leaf;
        right = Leaf;
        data = max_int; l;
        r = List.hd xs }, List.hd xs)
  else
    let (left, m) = init l (n / 2) xs in
    let (right, r) = init m ((n + 1) / 2) (drop (n / 2) xs) in
    (Node { left; right; data = max_int; l; r }, r)
let init (x :: xs) = fst @@ init x (List.length xs) xs

let rec update a b x = function
  | Leaf -> Leaf
  | Node ({ left; right; data; l; r } as t) ->
      if b <= l || r <= a || t.data <= x
      then Node t
      else begin
        if a <= l && r <= b
        then Node { t with data = min x t.data }
        else Node { t with left = update a b x left; right = update a b x right }
      end

let rec query acc i = function
  | Leaf -> acc
  | Node { left; right; data; l; r } ->
      if i < l || r <= i
      then acc
      else query (query (min acc data) i left) i right
let query = query max_int

let () = Scanf.scanf "%d %d\n" @@ fun n q ->
  let stxs =
    Array.init n @@ fun _ ->
      Scanf.scanf "%d %d %d\n" @@ fun s t x -> s, t, x in
  let tr =
    Array.fold_right (fun (s, t, x) -> update (s - x) (t - x) x) stxs @@
    init @@
    List.sort_uniq compare @@
    Array.fold_left (fun acc (s, t, x) -> s - x :: t - x :: acc) [] stxs in
  for i = 0 to q - 1 do
    Printf.printf "%d\n" @@ Scanf.scanf "%d\n" @@ fun d ->
      let ans = query d tr in
      if ans = max_int then -1 else ans
  done
