CANCELLED!


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 500M

Author:
Problem type
Allowed languages
Assembly, C, C++, Java, Pascal, Perl, Python, Text

Sounds like reputation 🐍

The media of Daerht City are relentlessly hunting down the \(N\) most influential movie stars. They are always targets of smear campaigns, so they must band together to support one another. Each star carries a number, which they call their personal code. The codes used are integers from 1 to \(N\), each person having chosen theirs based on their own story. No two people use the same code.

"It's easy to love you when you're popular

The optics click, everyon prospers

But one single drop, you're off the roster

Tone-deaf and hot, let's fuckin' off her"

In the city there are \(N\) special studios, numbered from 1 to \(N\). Many stars have been "cancelled" simply for working at a studio that their "fans" didn't like. After many such incidents, the group of stars has realized that if a person carrying code \(x\) works at the studio also numbered \(x\), that person will suffer a wave of media backlash.

Additionally, if on any two days all the stars' positions repeat exactly, they will all be cancelled, because the media would have spun some far-fetched narrative out of it. So they need to manipulate enough media influence as soon as possible. To do this, they need a plan. First, they define the position sequence of a day as a sequence of \(N\) integers, where the \(i\)-th integer is the index of the studio that the star carrying code \(i\) works at on that day. These position sequences are sorted in lexicographical order, numbered starting from 1. After discussion, they decide that on day \(k\), all of them will work at the studios according to the \(k\)-th position sequence.

"Welcome to my underworld

Where it gets quite dark

At least you know exactly who your friends are."

But it seems that within the group, a few people may want to betray the others. To find out who is friend and who is foe, the group leader has devised a plan to catch the "venomous snake." The leader intends to reveal everything on day \(Q\) of the plan. However, the leader needs to know which studio each member will be working at on day \(Q\).

Help make the snake-catching plan a success!

Input

  • A single line containing two positive integers \(N, Q \ (1\le N \le 10^3; 1\le Q \le 10^9)\). It is guaranteed that \(Q\) does not exceed the number of valid position sequences.

Output

  • Print on 1 line, \(N\) integers representing the index of the studio each member of the group works at on day \(Q\) (the position sequence of day \(Q\)).

Scoring

  • Subtask 1 (40%): \(N \le 8\).
  • Subtask 2 (60%): No additional constraints.

Example

Example 1

input

4 3

output

2 4 1 3

Comments

There are no comments at the moment.