#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
char s[110];
int main() {
	cin >> s;
	int k;
	scanf("%d", &k);
	for (int i = 0; i < strlen(s); ++i) {
		if (s[i] == '1') k--;
		else {
			putchar(s[i]);
			return 0;
		}
		if (k == 0) putchar('1');
	}
	return 0;
}