console.log((args=>{
  const tmp = args.trim().split`\n`;
  const S = tmp[0].split``.map(v=>v|0);
  const K = tmp[1]|0;
  for ( let i = 0;; i++ ) {
    if ( i+1 === K || S[i] !== 1 ) return `${S[i]}`
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
