import sequtils, strutils

let
  nw = stdin.readLine.split.map parseInt
  n = nw[0]
  w = nw[1]

var xs = n.newSeqWith stdin.readLine.split.map parseInt
xs.keepItIf it[1] <= w

if xs.len == 0:
  echo -1
  quit()

echo max xs.mapIt it[0]