function Main(input){
	input=input.split(/\n|\s/);
	var arr=[];
	var jl=input[0].length;
	for(var i=0;i<jl;i=(i+1)|0){
		for(var k=1;k<6;k=(k+1)|0){
			arr[arr.length]=input[0].slice(i,k+i);
		}
	}
	arr=arr.filter(function(x,i,self){return self.indexOf(x)===i;});
	arr.sort();
	console.log(arr[(input[1]|0)-1]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));