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