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