log = console.log;

var stdin = require("fs").readFileSync("/dev/stdin", "UTF-8");
var lines = stdin.split("\n").filter(v => v !== "").map(v=> v.split(" "));
var N = lines[0][0]
var K = lines[0][1]
lines = lines.slice(1);

var ary = [];

lines.forEach(v=>{
  for(var i=1;i<=v[1];i++){
    ary.push(v[0])
  }
})

ary.sort((a,b)=> a-b)
log(ary[K-1])