character(100) S
integer(16) N,i
read*,S
read*,N
if(N<=len_trim(S))then
  if(S(1:N)==repeat("1",N))then
    print"(A)","1"
    stop
  endif
end if
do i=1,len_trim(S)
  if(S(i:i)=="1")cycle
  print"(A)",S(i:i)
  exit
end do
end