import java.util.Scanner;
import java.util.ArrayList;

public class picos {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long K = sc.nextLong();
        K--;

        ArrayList<Long> front = new ArrayList<>();
        ArrayList<Long> back = new ArrayList<>();

        for (long i = N; i >= 2; i--) {
            long bit = i - 2;
            boolean goesFront = (bit < 63) && (((K >> bit) & 1L) == 1L);
            if (goesFront) {
                front.add(i);
            } else {
                back.add(i);
            }
        }

        for (long x : front) {
            System.out.print(x + " ");
        }
        System.out.print(1);
        for (int j = back.size() - 1; j >= 0; j--) {
            System.out.print(" " + back.get(j));
        }
        System.out.println();
        
        sc.close();
    }
}
