#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
  string ss;
  int k;cin>>ss>>k;
  for(int i=0;i<min((int)ss.size(),k);i++){
    if(ss.at(i)>'1'){cout<<ss.at(i)<<endl;return 0;}
  }
  cout<<1<<endl;
}