  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)
  console.log(all);
  for (const index in all) {
    cost += +all[index]
    if (cost < time) continue;
    console.log(cost > time ? index - 1 : index);
    return
  }