function main(input) {

    const lines = input.split('\n');
    const timeLimit = parseInt(lines.shift().split(' ')[1], 10)

    let minCost = 9999999;

    lines.map(line => {{cost: line.split(' ')[0], time: line.split(' ')[1]}}).forEach((p) => {
      if(parseInt(p.time, 10) > timeLimit) {
        return
      }
      if(parseInt(p.cost, 10) < minCost) {
        minCost = parseInt(p.cost, 10);
      }
    })
    console.log(timeLimit);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
