    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    #define rep(i,a,b) for(int i=(a);i<=(b);i++)
    #define mem(a,x) memset((a),x,sizeof (a))
    #define lson l,mid,rt<<1
    #define rson mid+1,r,rt<<1|1
    const LL LLINF = 0x3f3f3f3f3f3f3f3f;
    const int maxn=100+10;
    char s[maxn];
    int main() {
    #ifdef _DEBUG
        freopen("data.in", "r", stdin);
    #endif
        ios::sync_with_stdio(false);
        LL k;
        while(cin>>s>>k){
            LL p=0;
            int i=0;
            int len=strlen(s);
            char c=s[i];
            p=c=='1'?1:LLINF;
            while(i<len&&p<k){
                c = s[++i];
                if(c!='1') p=LLINF;
                else {
                    p ++;
                }
            }
            cout<<c<<endl;
        }
        return 0;
    }