fun main(args: Array<String>) {
    val firstLine = readLine()?.split(" ").orEmpty()
    val readCount = firstLine[0].toInt()
    var pastCount = 0L
    val resultOrder = firstLine[1].toLong()
    val bigList = mutableListOf<Pair<Int,Int>>()

    for(i in 0 until readCount){
        val valueLine = readLine()?.split(" ").orEmpty()
            bigList.add(Pair(valueLine[0].toInt(), valueLine[1].toInt()))
    }

    bigList.sortBy{it.first}

    run loop@{
        bigList.forEach {
            pastCount += it.second
            if(pastCount >= resultOrder){
                println(it.first)
                return@loop
            }
        }
    }
}