import Data.List
main=do
 s<-getLine
 k<-readLn
 let a=map(:[])s
 let b=zipWith(:)s$tail a
 let c=if length b==0 then [] else zipWith(:)s$tail b
 let d=if length c==0 then [] else zipWith(:)s$tail c
 let e=if length d==0 then [] else zipWith(:)s$tail d
 let ans=nub$sort$a++b++c++d++e
 putStrLn$ans!!(k-1)