
fun main(args: Array<String>) {
    var (count) = readLine()!!.split(" ").map { it.toInt() }
    val values = readLine()!!.split(" ").map { it.toInt() }
    val costs = readLine()!!.split(" ").map { it.toInt() }

    val diffs: MutableList<Int> = java.util.ArrayList()

    for (index in 0 until count) {
        diffs.add(values[index] - costs[index])
    }

    diffs.sort()
    val diffMax = diffs.filter { it > 0 }.asReversed()

    if (diffMax.size < count) count = diffMax.size

    val res = diffMax.subList(0, count).sum()

    print(res)
}
