let () =
    let main () =
        let n, q = Scanf.sscanf (read_line ()) "%d %d" (fun n q -> n, q) in
        let stx = Array.init n (fun _ -> Scanf.sscanf (read_line ()) "%d %d %d" (fun s t x -> x, s, t)) in
        let d = Array.init q (fun _ -> Scanf.sscanf (read_line ()) "%d" (fun d -> d)) in
        Array.sort compare stx;
        for i = 0 to q - 1 do
            let rec loop time pos j =
                if j = n then Printf.printf "-1\n" else
                    let (x, s, t) = stx.(j) in
                    if pos > x then loop time pos (j + 1) else
                        let dist = x - pos in
                        if time + dist < s || time + dist >= t then (
                            if j = n - 1 then loop time pos (j + 1) else
                                let (x2, _, _) = stx.(j + 1) in
                                if x2 = x then loop time pos (j + 1) else
                                    loop (time + dist) (pos + dist) (j + 1)
                        ) else Printf.printf "%d\n" x
            in
            loop d.(i) 0 0
        done
    in
    main ()