#include "testlib.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
 
// constexpr int MAX_N = 1'000'000;
// constexpr int MAX_A = (int)1e9;

signed main(int argc,char* argv[]){
	registerGen(argc,argv,1);
 
	int mx_n = atoi(argv[1]);
	int mx_k = atoi(argv[2]);
	int n = mx_n;
	int k = rnd.next(1,mx_k);
 
	std::cout << n << " " << k << "\n";
 
	std::vector<int> p = rnd.perm(n);
 
	std::vector<int> perm = rnd.perm(n);
	for(int i = 1; i < n; i++){
		p[perm[i-1]] = perm[i];
	}
	p[perm[n-1]] = perm[0];
 
	for(int i = 0; i < n; i++){
		std::cout << p[i] + 1;
		if(i != n-1)
			std::cout << " ";
	}
	std::cout << "\n";
 
	return 0;
}
