import scala.annotation.tailrec

object Main extends App {

  import scala.io.StdIn._
  import scala.math._


  val Array(n, q) = readLine.trim.split(' ').map(_.toInt)
  val history = List.tabulate(n){_ ⇒
    val Array(y, n) = readLine.trim.split(' ')
    (y.toInt, n)
  }
  println(
    history.foldLeft("kogakubu10gokan"){
      case (_, (year, next)) if year <= q ⇒ next
      case (prev, _) ⇒ prev
    }
  )
  implicit class Extenion[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}

