const readLines = (input) => input.split('\n')
const println = (value) => console.log(value)
const readInt = (input) => parseInt(input, 10)
const readIntList = (input) => input.split(' ').map(n => parseInt(n, 10))
const naturalOrder = (a, b) => {
    if (b == a) return 0
    return (a < b) ? -1 : 1
}

function main(input) {
    const lines = readLines(input)
    const [n, m, k] = readIntList(lines[0])
    const aArray = readIntList(lines[1]).sort(naturalOrder)
    const bArray = readIntList(lines[2]).sort(naturalOrder)

    let aSum = aArray.reduce((acc, a) => acc + a)
    let bSum = bArray.reduce((acc, b) => acc + b)
    let nonReadCount = 0
    let ai = aArray.length - 1
    let bi = bArray.length - 1
    while (aSum + bSum > k) {
        if (ai < 0 && bi < 0) {
            break
        }

        nonReadCount++

        if (ai < 0) {
            bSum -= bArray[bi]
            bi--
            continue
        } else if (bi < 0) {
            aSum -= aArray[ai]
            ai--
            continue
        }

        if (aArray[ai] < bArray[bi]) {
            bSum -= bArray[bi]
            bi--
        } else {
            aSum -= aArray[ai]
            ai--
        }
    }
    println(aArray.length + bArray.length - nonReadCount)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
