  let input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n")
  let time = +input[0].split(" ")[2]
  let ATab = input[1].split(" ")
  let BTab = input[2].split(" ")
  let count = 0
  let cost = 0
  if (time < +ATab[0] && time < +BTab[0]) {
    console.log(count);
    return
  }
  let all = ATab.concat(BTab).sort((a, b) => +a - +b)

  while (cost <= time) {
    cost += +all[count++]
  }
  console.log(count - 1);