'use strict'

function main(input) {

    input = input.split('\n').map(v => v.split(' ').map(v => ~~v))

    let x = input[1][2]
    let a = input[1].slice(0, x)
    let b = input[1].slice(x, input[1].length)

    let ans = Math.min(a.length, b.length)

    console.log(ans)


}

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