import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class TestGen {
	class Test {
		int n, k;
		int[] a;

		public Test(int n, int k, int... a) {
			this.n = n;
			this.k = k;
			this.a = a;
		}

	}

	private int testCount = 0;

	private void write(Test t) {
		try {
			++testCount;
			System.err.println(testCount + " " + t.n + " " + t.k + ": " + solve(t));
			String filename = testCount / 10 + "" + testCount % 10;
			PrintWriter out = new PrintWriter(filename);
			out.println(t.n + " " + t.k);
			for (int i = 0; i < t.a.length; i++) {
				out.print(t.a[i]);
				if (i != t.a.length - 1) {
					out.print(" ");
				}
			}
			out.println();
			out.flush();
			out.close();
		} catch (IOException ex) {
			throw new RuntimeException(ex);
		}
	}

	void myAssert(boolean b) {
		if (!b)
			throw new AssertionError();
	}

	final static int MAXN1 = 1000;
	final static int MAXA1 = 1000;
	final static int MAXN = 100000;
	final static int MAXA = (int) 1e9;
	static Random rand = new Random(3);

	public void run() throws IOException {
		for (int i = 0; i < 2; i++) {
			write(rand(10, rand.nextInt(10) + 1, 100));
		}
		// write(rand(MAXN1, MAXN1, MAXA1));
		// write(rand(MAXN1, 999, MAXA1));
		write(rand(MAXN1, 5, MAXA1));
		write(rand(MAXN1, 500, MAXA1));
		write(rand(MAXN1, 239, MAXA1));
		write(addDirt(special1(MAXN1, 100, MAXA1), 0.7, MAXA1));
		write(addDirt(special1(MAXN1, 100, MAXA1), 0.3, MAXA1));
		write(addDirt(special1(MAXN1, 420, MAXA1), 0.02, MAXA1));
		for (int i = 0; i < 2; i++) {
			write(rand(MAXN1, MAXA1));
		}

		write(rand(MAXN, 1, MAXA1));
		write(rand(MAXN, (int) Math.sqrt(MAXN), MAXA1));
		write(addDirt(special1(MAXN, 100, MAXA1), 0.1, MAXA1));
		write(addDirt(special1(MAXN, (int) Math.sqrt(MAXN) + rand.nextInt(100), MAXA1), 0.02, MAXA1));
		for (int i = 0; i < 6; i++) {
			write(rand(MAXN, MAXA1));
		}

		write(rand(MAXN, MAXN, MAXA));
		for (int i = 0; i < 4; i++) {
			write(rand(MAXN, rand.nextInt(MAXN) + 1, MAXA));
		}

	}

	Test rand(int n, int k, int maxa) {
		while (true) {
			int[] a = new int[n];
			for (int i = 0; i < a.length; i++) {
				a[i] = rand.nextInt(maxa) + 1;
			}
			if (maxa < k) {
				int[] p = new int[rand.nextInt(maxa) + 1];
				for (int i = 0; i < p.length; i++) {
					p[i] = rand.nextInt(maxa) + 1;
				}
				int r = rand.nextInt(Math.max(n / 2, 1));
				for (int i = 0; i < r; i++) {
					a[i] = p[rand.nextInt(p.length)];
				}
			} else if (k > 1) {
				int r = rand.nextInt(Math.max(n / 2, k));
				for (int i = 1; i < r; i++) {
					if (rand.nextDouble() < 1.2 / k) {
						a[i] = a[rand.nextInt(i)];
					}
				}
			}

			Test t = new Test(n, k, a);
			if (solve(t) != 1 || k == n || k == 1)
				return t;
		}

	}

	Test rand(int n, int maxa) {
		while (true) {
			int k = rand.nextInt(n) + 1;
			int[] a = new int[n];
			for (int i = 0; i < a.length; i++) {
				a[i] = rand.nextInt(maxa) + 1;
			}
			if (maxa < k) {
				int[] p = new int[rand.nextInt(maxa) + 1];
				for (int i = 0; i < p.length; i++) {
					p[i] = rand.nextInt(maxa) + 1;
				}
				int r = rand.nextInt(Math.max(n / 2, 1));
				for (int i = 0; i < r; i++) {
					a[i] = p[rand.nextInt(p.length)];
				}
			} else if (k > 1) {
				int r = rand.nextInt(Math.max(n / 2, k));
				for (int i = 1; i < r; i++) {
					if (rand.nextDouble() < 1.2 / k) {
						a[i] = a[rand.nextInt(i)];
					}
				}
			}

			Test t = new Test(n, k, a);
			if (solve(t) != 1)
				return t;
		}

	}

	Test special1(int n, int k, int maxa) {
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = (i % maxa) + 1;
		}
		return new Test(n, k, a);
	}

	Test addDirt(Test t, double prob, int maxa) {
		do {
			for (int i = 0; i < t.a.length; i++) {
				if (rand.nextDouble() < prob) {
					t.a[i] = rand.nextInt(maxa) + 1;
				}
			}
		} while (solve(t) == 1);
		return t;
	}

	int solve(Test t) {
		map = new HashMap<Integer, Integer>();
		int best = 0;
		int besti = 0;
		for (int i = 0; i < t.k; i++) {
			inc(t.a[i]);
		}
		if (map.size() > best) {
			best = map.size();
			besti = 1;
		}
		for (int i = t.k; i < t.a.length; i++) {
			dec(t.a[i - t.k]);
			inc(t.a[i]);
			if (map.size() > best) {
				best = map.size();
				besti = i - t.k + 2;
			}
		}
		return besti;
	}

	void inc(int k) {
		if (map.containsKey(k)) {
			map.put(k, map.get(k) + 1);
		} else {
			map.put(k, 1);
		}
	}

	void dec(int k) {
		if (map.get(k) == 1) {
			map.remove(k);
		} else {
			map.put(k, map.get(k) - 1);
		}
	}

	Map<Integer, Integer> map;

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

}
