function main(arg) {
  const array = arg.trim().split("\n");
  const firstArray = array[0].trim().split(" ");
  let N = parseInt(firstArray[0], 10);
  let M = parseInt(firstArray[1], 10);
  let K = parseInt(firstArray[2], 10);
  let aBooks = array[1].trim().split(" ");
  let bBooks = array[2].trim().split(" ");

  let counter = 0;
  while (true) {
    let readBook = 0;

    if (aBooks.length == 0 && bBooks.length == 0) {
      break;
    }

    let A = 0;
    let B = 0;

    // ** 配列の先頭を取得
    A = parseInt(aBooks[0], 10);
    B = parseInt(bBooks[0], 10);

    if (!A) {
      A = 0;
    }

    if (!B) {
      B = 0;
    }

    // ** 取得した要素を比較
    if (A < B) {
      if (A == 0) {
        readBook = B;
        bBooks.shift();
      } else {
        readBook = A;
        aBooks.shift();
      }
    } else {
      if (B == 0) {
        readBook = A;
        aBooks.shift();
      } else {
        readBook = B;
        bBooks.shift();
      }
    }
    K -= readBook;
    if (K < 0) {
      break;
    }
    counter++;
  }
  console.log(counter);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
// main(
//   "5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000"
// );
// main("1 1 240\n1\n1");
// main("3 4 730\n60 90 120\n80 150 80 150");
// main("3 4 240\n60 90 120\n80 150 80 150");
//https://atcoder.jp/contests/abc167/tasks/abc167_b
