"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = arg[0].split("").map(n=>~~n);
    const K = ~~arg[1];
    
    for(let i in S) {
        if(S[i] !== 1) {
            console.log(S[i]);
            return;
        }
    }
    
    console.log(1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));