import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            String s = scan.nextLine();
            int k = scan.nextInt();
            PriorityQueue<String> queue = new PriorityQueue<>((o1,o2)-> o2.compareTo(o1));
            Set<String> vis = new HashSet<>();
            for(int i = 0; i < s.length(); i++){
                for(int j = i +1; j < s.length() && (j-i) <= k; j++){
                    if(vis.add(s.substring(i,j))){
                        if(queue.size() == k){
                            if(queue.peek().compareTo(s.substring(i,j)) <= 0){
                                continue;
                            }
                            queue.poll();
                        }
                        queue.offer(s.substring(i,j));
                    }
                }
            }
            System.out.println(queue.poll());
        }
    }
}