import scala.collection.mutable
import scala.io.StdIn._
object Main extends App{


  val Array(n, q) = readLine.trim.split(' ').map(_.toInt)

  val stops = Array.tabulate(n){_ ⇒
    val Array(s, t, x) = readLine.trim.split(' ').map(_.toInt)
    Stop(s, t, x)
  }
  val persons = Array.tabulate(q){i ⇒ (i, readLine.trim.toInt)}.sortBy(_._2)
  case class Stop(from: Int, to: Int, coordinate: Int)
  val startAt = mutable.PriorityQueue[(Int, Stop)]()(Ordering.by[(Int, Stop), Int](_._1).reverse)
  val endAt = mutable.PriorityQueue[(Int, Stop)]()(Ordering.by[(Int, Stop), Int](_._1).reverse)
  for (s ← stops) {
    startAt.enqueue((s.from - s.coordinate, s))
  }
  val position = Array.fill(q){-1}
  for ((i, d) ← persons) {
    while(startAt.nonEmpty && startAt.head._1 <= d){
      val (_, s) = startAt.dequeue()
      endAt.enqueue((s.coordinate, s))
    }
    while(endAt.nonEmpty && endAt.head._2.to - endAt.head._2.coordinate <= d){
      endAt.dequeue()
    }
    if (endAt.nonEmpty) {
      position(i) = endAt.head._1
    }
  }
  println(position.mkString("\n"))

}