object Main extends App {
  val nmk = scala.io.StdIn.readLine()
  val nmkArray = nmk.split(" ").map(_.toLong).toSeq
  val k = nmkArray(2)

  val a = scala.io.StdIn.readLine()
  val aArray = a.split(" ").map(_.toLong).toVector.sorted
  var aArrayTemp = aArray

  val b = scala.io.StdIn.readLine()
  val bArray = b.split(" ").map(_.toLong).toVector.sorted
  var bArrayTemp = bArray

  var result = 0
  var timeCount = 0L

  while (timeCount <= k) {
    val aMin = if (aArrayTemp.length > 0) Some(aArrayTemp.head) else None
    val bMin = if (bArrayTemp.length > 0) Some(bArrayTemp.head) else None
    if (aMin.isEmpty && bMin.isEmpty) {
      timeCount = k + 1L
    } else {
      val min = if (aMin.isEmpty) {
        bArrayTemp = bArrayTemp.tail
        bMin
      } else if (bMin.isEmpty) {
        aArrayTemp = aArrayTemp.tail
        aMin
      } else {
        if (aMin.get < bMin.get) {
          aArrayTemp = aArrayTemp.tail
          aMin
        } else {
          bArrayTemp = bArrayTemp.tail
          bMin
        }
      }
      timeCount = timeCount + min.get
      if (timeCount <= k) {
        result = result + 1
      }
    }
  }

  println(result)
}