function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    let S = input[0][0];
    let K = input[1][0];
    K = BigInt(K);
    let ans;
    if (S[0] !== '1') ans = S[0];
    else {
        let flag;
        let tmpLength = 0n;
        ans = 1;
        for (let i = 0; i < S.length; i++){
            flag = false;
            if (S[i] !== '1') {
                ans = S[i];
                break;
            }
            tmpLength = tmpLength + 1n;
            flag = true;
        }

        if (!flag){
            if (K <= tmpLength) ans = 1;
        }
    }

    console.log(ans);

}

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