import std.stdio;
import std.ascii;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;

void main()
{
    string s = readln.chomp;
    long k = readln.chomp.to!long;
    long firstone = -1;
    foreach (size_t i, char c; s)
        if (c != '1')
        {
            firstone = i;
            break;
        }
    // s[0..firstone].writeln;
    if (k <= firstone)
    {
        "1".writeln;
        return;
    }
    if (firstone == -1)
    {
        s[0].writeln;
        return;
    }
    s[firstone].writeln;
}
