def solve(string):

    s, k = string.split()

    if len(s) == 1:

        return s

    k = int(k)

    for _s in s[:k]:

        if _s != "1":

            return _s

    else:

        return "1"





if __name__ == '__main__':

    print((solve('\n'.join([eval(input()), eval(input())]))))

def solve(string):

    s, k = string.split()

    for _s in s[:int(k)]:

        if _s != "1":

            return _s

    else:

        return "1"





if __name__ == '__main__':

    print((solve('\n'.join([eval(input()), eval(input())]))))

def solve(string):
    s, k = string.split()
    if len(s) == 1:
        return s
    k = int(k)
    for _s in s[:k]:
        if _s != "1":
            return _s
    else:
        return "1"


if __name__ == "__main__":
    print((solve("\n".join([eval(input()), eval(input())]))))

def solve(string):
    s, k = string.split()
    for _s in s[: int(k)]:
        if _s != "1":
            return _s
    else:
        return "1"


if __name__ == "__main__":
    print((solve("\n".join([eval(input()), eval(input())]))))

-    if len(s) == 1: -        return s -    k = int(k) -    for _s in s[:k]: +    for _s in s[: int(k)]: