#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <climits>
#include <bitset>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
using ll = long long int;
const ll MOD = 1e9 + 5;

ll mod_pow(ll k, ll p)
{
    if (k == 0)
    {
        return 1 % p;
    }
    if (k == 1)
    {
        return 2 % p;
    }

    if (k % 2 == 0)
    {
        ll tmp = mod_pow(k / 2, p);
        return tmp * tmp % p;
    }
    else
    {
        ll tmp = mod_pow((k - 1) / 2, p);
        tmp *= tmp;
        tmp %= p;
        tmp *= 2;
        tmp %= p;
        return tmp;
    }
}

ll pow_fast(ll n, ll k)
{
    if (k == 0)
    {
        return 1;
    }
    if (k == 1)
    {
        return n;
    }

    if (k % 2 == 0)
    {
        ll tmp = pow_fast(n, k / 2) % MOD;
        return tmp * tmp % MOD;
    }
    else
    {
        ll tmp = pow_fast(n, (k - 1) / 2);
        return tmp * tmp * n;
    }
}
map<ll, ll> sosuu(ll n)
{
    map<ll, ll> mp;
    for (ll i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            n /= i;
            mp[i] += 1;
        }
    }
    if (n != 1)
    {
        mp[n] += 1;
    }
    return mp;
}

class Tree
{
private:
    vector<vector<ll>> edge;
    vector<ll> counter;

public:
    Tree() : counter(1000000, 0), edge(1000000){};
    ~Tree(){};

    void add(ll n, ll k)
    {
        this->edge[n].push_back(k);
        this->edge[k].push_back(n);
    }

    void query(ll p, ll x)
    {
        this->counter[p] += x;
    }

    void create()
    {
        vector<vector<ll>> children(1000000);
        vector<bool> visited(1000000, false);

        // 木の生成
        {
            queue<ll> Q;
            Q.push(1);
            visited[1] = true;

            while (!Q.empty())
            {
                ll top = Q.front();
                Q.pop();
                vector<ll> dist = this->edge[top];

                for (ll j = 0; j < dist.size(); j++)
                {
                    ll c = dist[j];
                    if (visited[c])
                    {
                        continue;
                    }
                    children[top].push_back(c);
                    Q.push(c);
                    visited[c] = true;
                }
            }
        }
        // 探索開始
        {
            queue<ll> Q;
            Q.push(1);
            while (!Q.empty())
            {
                ll top = Q.front();
                Q.pop();

                vector<ll> child = children[top];
                for (auto &&e : child)
                {
                    this->counter[e] += this->counter[top];
                    Q.push(e);
                }
            }
        }
    }
    ll count(ll n)
    {
        return this->counter[n];
    }
};

struct Plain
{
    ll xi;
    ll yi;
    char dir;
};

int main()
{
    string S;
    cin >> S;

    ll K;
    cin >> K;

    char ans = '1';
    for (ll i = 0; i < S.size(); i++)
    {
        if (S[i] != '1')
        {
            ans = S[i];
            break;
        }
        if (i == K - 1)
        {            
            ans = '1';
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3568