import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto S = readln.split[0];
	auto K = readln.split[0].to!long;
	foreach (c; S) {
		if (K == 1 || c != '1') { writeln(c); return; }
		else K--;
	}
	writeln(1);
}