import java.io.*;
import java.util.*;

public class TestGen {
	public static void main(String[] args) throws IOException {
		new TestGen().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	int tNumber = 0;
	
	void print(int n, int k, int[] a) throws IOException {
		System.err.println(tNumber);
		if (tNumber < 10) {
			out = new PrintWriter("../tests/0" + tNumber);
		} else {
			out = new PrintWriter("../tests/" + tNumber);
		}
		tNumber++;
		out.println(n + " " + k);
		for (int i = 0; i < n - k + 1; i++) {
			out.print(a[i] + (i == n - k ? "\n" : " "));
		}                                   
		out.close();
	}
	void genSimple() throws IOException {
		int[] a = new int[2];
		a[0] = 0;
		a[1] = 1;
		print(3, 2, a);
	}
	 void swap(int[] a, int i, int j) {
	    int t = a[i];
	    a[i] = a[j];
	    a[j] = t;
	  }
         int[] getRandomPermutation(int n, Random rnd) {
 	  	 int[] res = new int[n];
    		for (int i = 0; i < n; i++)
      			res[i] = i;
		    for (int i = 0; i < n; i++)
      			swap(res, i, i + rnd.nextInt(n - i));
		    return res;
	}
	Random rnd;
	void genRandom(int n, int k) throws IOException {
		int[] p =  getRandomPermutation(n, rnd);
		int[] a = new int[n - k + 1];	
		for (int i = 0; i < n - k + 1; i++) {
			int cur = 0;
			for (int j = i; j < i + k; j++) {
				for (int q = j + 1; q < i + k; q++) {
					if (p[j] > p[q]) cur++;
				}
			}
			a[i] = cur;
		} 
		print(n, k, a);
	}

	boolean nextPermutation(int[] p) {
		for (int a = p.length - 2; a >= 0; --a)
			if (p[a] < p[a + 1])
				for (int b = p.length - 1;; --b)
					if (p[b] > p[a]) {
						int t = p[a];
						p[a] = p[b];
						p[b] = t;
						for (++a, b = p.length - 1; a < b; ++a, --b) {
							t = p[a];
							p[a] = p[b];
							p[b] = t;
						}
						return true;
					}
		return false;
	}

	void genAll(int n, int k) throws IOException {
	 	int[] p = new int[n];
		for (int i = 0; i < n; i++) {
			p[i] = i;
		}
		ArrayList<Integer[]> al = new ArrayList<>();
                do {
			int[] a = new int[n - k + 1];	
			for (int i = 0; i < n - k + 1; i++) {
				int cur = 0;
				for (int j = i; j < i + k; j++) {
					for (int q = j + 1; q < i + k; q++) {
						if (p[j] > p[q]) cur++;
					}
				}
				a[i] = cur;
			} 
			boolean f = false;
			for (int i = 0; i < al.size(); i++) {
				Integer[] pq = al.get(i);
				boolean f1 = true;
				for (int j = 0; j < n - k + 1; j++) {
					if (a[j] != pq[j]) {
						f1 = false;
						break;
					}
				}
				f |= f1;
			}
			if (!f)
				print(n, k, a);
			Integer[] tmp = new Integer[n - k + 1];
			for (int i = 0; i < n - k + 1; i++) {
				tmp[i] = a[i];
			}
			al.add(tmp);
	        } while (nextPermutation(p));
	}

	void genPKTest1(int n, int k) throws IOException {
		int[] p = new int[n];
		for (int i = 0; i < n; i++) {
			p[i] = i;
		}
		for (int i = 0; i < rnd.nextInt(20) + 10; i++) {
			int j = rnd.nextInt(n);
			int q = rnd.nextInt(n);
			int x = p[j];
			p[j] = p[q];
			p[q] = x;
		}
		int[] a = new int[n - k + 1];	
		for (int i = 0; i < n - k + 1; i++) {
			int cur = 0;
			for (int j = i; j < i + k; j++) {
				for (int q = j + 1; q < i + k; q++) {
					if (p[j] > p[q]) cur++;
				}
			}
			a[i] = cur;
		} 
		print(n, k, a);
	}


	void genPKTest2(int n, int k) throws IOException {
		int[] p = new int[n];
		for (int i = 0; i < n; i++) {
			p[i] = n - i - 1;
		}
		for (int i = 0; i < rnd.nextInt(20) + 10; i++) {
			int j = rnd.nextInt(n);
			int q = rnd.nextInt(n);
			int x = p[j];
			p[j] = p[q];
			p[q] = x;
		}
		int[] a = new int[n - k + 1];	
		for (int i = 0; i < n - k + 1; i++) {
			int cur = 0;
			for (int j = i; j < i + k; j++) {
				for (int q = j + 1; q < i + k; q++) {
					if (p[j] > p[q]) cur++;
				}
			}
			a[i] = cur;
		} 
		print(n, k, a);
	}


	public void generate() throws IOException {
		new File("../tests").mkdir();
		tNumber = 1;
		rnd = new Random(133131131);
		genSimple();      
		genAll(3, 2);
		genAll(2, 2);
	        genAll(3, 3);
	        genAll(4, 4);
	        genAll(5, 5);
		genAll(4, 2);
		genAll(4, 3);
		for (int i = 0; i < 3; i++) {
			genPKTest1(100000, 5);
		}
		for (int i = 0; i < 3; i++) {
			genPKTest2(100000, 5);
		}
		for (int i = 0; i < 9; i++) {
			genRandom(10, 4);
		}
		for (int i = 0; i < 9; i++) {
			genRandom(11, 5);
		}
		for (int i = 0; i < 13; i++) { 
			genRandom(100000, 5); 
		}           
		for (int i = 0; i < 11; i++) { 
			genRandom(99999, 5); 
		}           

	}

	public void run() throws IOException {
		Locale.setDefault(Locale.US);
		generate();
	}
}