import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    s = eval(input())

    k = int(eval(input()))



    for i in range(k):

        if s[i] != "1":

            res = s[i]

            break

    else:

        print((1))

        exit()



    print(res)





if __name__ == '__main__':

    resolve()

import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    s = eval(input())

    k = int(eval(input()))

    if k >= len(s):

        for i in range(len(s)):

            if s[i] != "1":

                print((s[i]))

                break

        else:

            print((1))

    else:

        for i in range(k):

            if s[i] != "1":

                print((s[i]))

                break

        else:

            print((1))





if __name__ == '__main__':

    resolve()

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    s = eval(input())
    k = int(eval(input()))
    for i in range(k):
        if s[i] != "1":
            res = s[i]
            break
    else:
        print((1))
        exit()
    print(res)


if __name__ == "__main__":
    resolve()

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    s = eval(input())
    k = int(eval(input()))
    if k >= len(s):
        for i in range(len(s)):
            if s[i] != "1":
                print((s[i]))
                break
        else:
            print((1))
    else:
        for i in range(k):
            if s[i] != "1":
                print((s[i]))
                break
        else:
            print((1))


if __name__ == "__main__":
    resolve()

-    for i in range(k): -        if s[i] != "1": -            res = s[i] -            break +    if k >= len(s): +        for i in range(len(s)): +            if s[i] != "1": +                print((s[i])) +                break +        else: +            print((1)) -        print((1)) -        exit() -    print(res) +        for i in range(k): +            if s[i] != "1": +                print((s[i])) +                break +        else: +            print((1))