#include using namespace std; int main(){ long long n,k; cin >> n >> k; if(k == 1){ cout << 0 << endl; return 0; } vector a(20,1); int now = 0; while(n > 0){ now++; a[now] = a[now - 1] * (n % 10 + 1); n /= 10; } // for(int j = 0;j <= now;j++){ // cout << a[j] << " "; // } // cout << endl; bool c = 0; k--; for(int j = now;j >= 0;j--){ //cout << k << endl; if((k / a[j] > 0) || c == 1){ cout << k / a[j]; c = 1; } k %= a[j]; } cout << endl; return 0; }