open Printf
open Scanf

let id x = x

let (s, k) = scanf "%s %Ld" (fun s k -> s, k)

let () =
    let r = ref k in
    String.iteri (fun i c ->
        if c <> '1' then (printf "%c\n" c; exit 0);
        if !r = 1L then (printf "%c\n" c; exit 0);
        r := Int64.pred !r
    ) s
