"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const M = parseInt(arg[0].split(" ")[1]);
    let K = parseInt(arg[0].split(" ")[2]);
    
    const A = arg[1].split(" ").map(n=>parseInt(n));
    const B = arg[2].split(" ").map(n=>parseInt(n));
    
    let Ai = 0;
    let Bi = 0;
    
    let answer = 0;
    
    // 左右見て早く読める本を選択し続ける
    while(K > 0) {
        const a = A[Ai];
        const b = B[Bi];
        
        if(K < a && K < b) break;
        
        if(a <= b && Ai < N) {
            K -= a;
            Ai++;
            // console.log("Aの一番上:" + a + "の本を読んだ");
        } else {
            if(Bi >= M) break;
            K -= b;
            Bi++;
            // console.log("Bの一番上:" + b + "の本を読んだ");
        }
        
        
        answer++;
        // console.log("残り時間:" + K);
        // console.log("--------");
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));