import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}


func main() {
    let line = readInts()
    var n = line[0]
    var m = line[1]
    var k = line[2]

    var bookA = readInts()
    var bookB = readInts()

    for i in 0...bookA.count + bookB.count {
        if bookA[0] < bookB[0] && n > 0 {
            k -= bookA[0]
            n -= 1
            bookA.remove(at: 0)
        }
        else if m > 0{
            k -= bookB[0]
            m -= 1
            bookB.remove(at: 0)
        }
        if k < 0 {
            print(i)
            return
        }
    }
}
main()
