#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

// Function to calculate the sum of divisors of a number
int sumDiv(int num)
{
    int sum = 0;
    for (int i = 1; i * i <= num; i++)
    {
        if (num % i == 0)
        {
            sum += i;
            if (i != num / i)
            {
                // Add the complementary divisor
                sum += num / i;
            }
        }
    }
    return sum;
}

unsigned int getFirstSetBitPos(int n)
{
    return log2(n & -n) + 1;
}
// Topological Sort using DFS
void dfs(int v, vector<vector<int>>& adj, vector<bool>& visited, vector<int>& ans)
{
    visited[v] = true;
    for (auto u : adj[v])
    {
        if (!visited[u])
        {
            dfs(u, adj, visited, ans);
        }
    }
    ans.push_back(v); // Add to result after visiting all neighbors
}

// Check if there is a cycle in the graph
bool hasCycle(int v, vector<vector<int>>& adj, vector<bool>& visited, vector<bool>& recStack)
{
    visited[v] = true;
    recStack[v] = true;

    for (auto u : adj[v])
    {
        if (!visited[u] && hasCycle(u, adj, visited, recStack))
            return true;
        else if (recStack[u]) // If the node is in the recursion stack, cycle is present
            return true;
    }

    recStack[v] = false;
    return false;
}

// Function to check if the graph is a DAG
bool isDAG(vector<vector<int>>& adj, int n)
{
    vector<bool> visited(n + 1, false), recStack(n + 1, false);
    for (int i = 1; i <= n; ++i)
    {
        if (!visited[i] && hasCycle(i, adj, visited, recStack))
            return false;
    }
    return true;
}

// Function to construct the dependency graph
void buildGraph(int n, vector<vector<int>>& adj, int C)
{
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if (i == j) continue;
            if (i % j == 0)
                adj[i].push_back(j); // i must appear before j


           else  if (getFirstSetBitPos(i) >getFirstSetBitPos(j))
                adj[i].push_back(j); // i must appear before j


        }
    }
}

void testcase()
{
    cout << getFirstSetBitPos(6)<<endl;
    int n, C;
    cin >> n >> C;

    vector<vector<int>> adj(n + 1);
    buildGraph(n, adj, C);

    if (!isDAG(adj, n))
    {
        cout << "Graph contains a cycle. Topological sort not possible.\n";
        return;
    }

    // Perform topological sort
    vector<int> res;
    vector<bool> visited(n + 1, false);
    for (int i = 1; i <= n; ++i)
    {
        if (!visited[i])
        {
            dfs(i, adj, visited, res);
        }
    }

    reverse(res.begin(), res.end());

    // Output the result
    for (auto x : res)
    {
        cout << x << " ";
    }
    cout << endl;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    speed

    int t = 1;
    while (t--)
    {
        testcase();
    }

    return 0;
}
