public static void main(String[] args) throws IOException, ClassNotFoundException {
		int n, k;
		Random gen = new Random();
		
		if (args.length == 1) {
			n = Integer.valueOf(args[0]);
			k = gen.nextInt(n) + 1;
		} else if (args.length == 2) {
			n = Integer.valueOf(args[0]);
			k = Integer.valueOf(args[1]);
		} else {
			n = gen.nextInt(100000);
			k = gen.nextInt(n) + 1;
		}
		
		List<Integer> A = new ArrayList<Integer>(n);
		for (int i = 0; i < n; ++i) {
			A.add(i);
		}
		
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		ObjectOutputStream oos = new ObjectOutputStream(baos);
		for (Integer i : A) {
			oos.writeObject(i);
		}
		
		System.out.println(n + " " + k);
		
		ByteArrayInputStream sin = new ByteArrayInputStream(baos.toByteArray());
		List<Integer> ans = reservoir_sampling(sin, k);
		
		assert ans.size() == k;

		close(baos);
		close(oos);
		// simplePrint(ans);
	}