#include #if __has_include() #endif using namespace std; #define eb emplace_back #define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__) #define of(i,...) for(auto[i,i##stop,i##step]=for_range(1,__VA_ARGS__);i>=i##stop;i+=i##step) #define fe(a,e,...) for(auto&&__VA_OPT__([)e __VA_OPT__(,__VA_ARGS__]):a) #define defpp templatevoid pp(const auto&...a){[[maybe_unused]]const char*c="";((o<(a...);} #define entry defpp void main();void main2();}int main(){my::io();my::main();}namespace my{ namespace my{ void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<constexpr auto for_range(T s,T b){T a=0;if(s)swap(a,b);return array{a-s,b,1-s*2};} void lin(auto&...a){(cin>>...>>a);} auto encode_integer(char c){return c-'0';} bool amin(auto&a,const auto&b){return busing pack_back_t=tuple_element_t>; } namespace my{ templatestruct vec; templatestruct hvec_helper{using type=vec::type>;}; templatestruct hvec_helper<0,T>{using type=T;}; templateusing hvec=hvec_helper::type; templatestruct vec:vector{ using vector::vector; auto&emplace_back(auto&&...a){vector::emplace_back(std::forward(a)...);return*this;} }; templaterequires(sizeof...(A)>=2)vec(const A&...a)->vec>>; auto sin(){string s;lin(s);return s;} templateauto sinen_integer(){vecr;fe(sin(),e)r.eb(encode_integer(e));return r;} } namespace my{entry void main(){ LL(N,K); auto T=sinen_integer(); vec dp(N+1,ll{}); // dp[i]:i文字目以降を使って出来る文章の個数. dp[N]=1; of(i,N){ if(T[i]==0)continue; // 0は一つ前の数字と一緒に使わないとダメ. dp[i]+=dp[i+1]; amin(dp[i],K+1); if(i+1=K){ res+='a'+(T[i]-1); i++; } else{ K-=dp[i+1]; res+='a'+(T[i]*10+T[i+1]-1); i+=2; } } pp(res); }}