import Data.List

main = do
 s <- getLine
 x <- readLn 
 if length s == 1 then putStrLn s
  else putStrLn ((sort $ nub  [ take len str     |str<-[drop begin s|begin<-[0..length s -2]], len<-[1..length str] ])!!(x-1))