function Main(input) {
    var ans = 1;
    input = input.split("\n");
    for (var i = 0; i < input[0].length; i++) {
        if (input[0][i] != '1') {
            ans = input[0][i];
            break;
        }
    }
    if (i >= input[1]) ans = 1;
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
