// #include // Temp fix for gcc13 global pragma // #pragma GCC target("avx2,bmi2,popcnt,lzcnt") // #pragma GCC optimize("O3,unroll-loops") #include // #include using namespace std; using namespace numbers; #ifdef LOCAL #include "Debug.h" #else #define debug_endl() 42 #define debug(...) 42 #define debug2(...) 42 #define debug_bin(...) 42 #endif // Returns the largest integer k with x >= k * y template U floor_div(T x, U y){ assert(y > 0); return x / y - (x % y < 0); } // Returns the smallest integer k with x <= k * y template U ceil_div(T x, U y){ assert(y > 0); return x / y + (x % y > 0); } template T &ctmin(T &x){ return x; } template T &ctmin(T &x, const Head &h, const Tail &... t){ return ctmin(x = min(x, h), t...); } template T &ctmax(T &x){ return x; } template T &ctmax(T &x, const Head &h, const Tail &... t){ return ctmax(x = max(x, h), t...); } // std::chunk_by cuz AtCoder is stuck on 3 years old gcc vector> chunk_by(auto data, auto eq){ vector> chunks; for(auto l = data.begin(); l != data.end(); ){ auto r = next(l); vector chunk{*l}; while(r != data.end() && eq(*prev(r), *r)){ chunk.push_back(*r); r = next(r); } chunks.push_back(chunk); l = r; } return chunks; } int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); int n; long long k; string s; cin >> n >> k >> s, -- k; vector cnt(n + 1); cnt[n] = 1; for(auto i = n - 1; i >= 0; -- i){ if(s[i] != '0'){ cnt[i] += cnt[i + 1]; } if(i + 2 <= n && (s[i] == '1' || s[i] == '2' && s[i + 1] <= '6')){ cnt[i] += cnt[i + 2]; } ctmin(cnt[i], numeric_limits::max() / 4); } assert(k < cnt[0]); string res; for(auto i = 0; i < n; ++ i){ assert(s[i] != '0'); if(k < cnt[i + 1]){ res += char(s[i] - '1' + 'a'); } else{ assert(i + 2 <= n && (s[i] == '1' || s[i] == '2' && s[i + 1] <= '6')); k -= cnt[i + 1]; assert(k < cnt[i + 2]); res += char(10 * (s[i] - '0') + s[i + 1] - '1' + 'a'); ++ i; } } cout << res << "\n"; return 0; } /* */