"use strict";

var _fs = require("fs");

var _fs2 = _interopRequireDefault(_fs);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var checkDup = function checkDup(arr) {
  return arr.filter(function (data, i, self) {
    return self.includes(data);
  });
};

var Main = function Main(input) {
  var str = input.split("\n")[0];
  var k = input.split("\n")[1];
  var result = [];

  for (var i = 1; i < str.length; i++) {
    for (var j = 0; j + i <= str.length; j++) {
      result.push(str.substring(j, j + i));
    }
  }
  console.log(checkDup(result)[result.length - k]);
};

Main(_fs2.default.readFileSync("/dev/stdin", "utf8"));