function Main(s){
  s = s.split("\n");
  var k = s[1];
  s = s[0];
  var ans = 1;
  k = Math.min(s.length, +k)
  for(var i = 0; i < k; i++){
    if(s[i] !== "1"){ans = s[i]; break;}
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));