program ABC106C
    implicit none
    integer(8)::K,i
    character(1)::ans
    character(100)::S
    read*,S,K

    do i=1,len_trim(S)
        if(S(i:i)=="1")then
            K=K-1
        else
            ans=S(i:i)
            exit
        end if
    end do
    if(K<1)then
        ans="1"
    end if

    print'(A)',ans
end program ABC106C