require 'set'

s = gets.strip
k = gets.to_i

# i から始まる substring をすべて上げる
def uniq_substr(s, i, carry)
  return carry if s.empty?
  ind = s.index(i)
  return carry if ind.nil?
  len = s.size
  for j in (0..len - ind)
    sub = s[ind..(ind + j)]
    carry << sub
  end
  uniq_substr(s[(ind+1)..-1], i, carry)
end

# puts uniq_substr("abcdabg", "a", Set.new).to_a

count = 0
for i in ('a'..'z')
  sub = uniq_substr(s, i, Set.new).to_a.sort
  if count + sub.size >= k
    puts sub[k - count - 1]
    exit 0
  else
    count += sub.size
  end
end
