function Main(input) {
	input = input.split("\n");
    const tmp1 = input[0].split(" ");
    const timeA = input[1].split(" ");
    const timeB = input[2].split(" ");

    const numA = tmp1[0];
    const numB = tmp1[1];
    const timeLimit = tmp1[2];
    const bkTotal = parseInt(numA) + parseInt(numB);
    let timeTotal = 0;
    let numTotal = 0;

    for(let i=0 ; i<bkTotal ; i++){
      
        if(!isNaN(timeA[i]) && timeTotal < timeLimit){
            timeTotal += parseInt(timeA[i]);
            if(timeTotal < timeLimit) numTotal++;
        }

        if(!isNaN(timeB[i]) && timeTotal < timeLimit){
            timeTotal += parseInt(timeB[i]);
            if(timeTotal < timeLimit) numTotal++;
        }

    }
    console.log( '%d', numTotal);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
