let aa1a2an permutation n natural number 12n you give positive integer k sequence Bb1b2bn bi number element aj a left element ati ajikfor example n5 possible a 51423 for k2 B give 12100 but k3 b11000for sequence Xx1x2xn Yy1y2yn let ith element element xiyi if xiyi X lexicographically small Y xiyi X lexicographically great YGiven n k B need determine lexicographically small a