public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		StringBuilder out = new StringBuilder();
		boolean first = true, prevNoEmpty = true;
		while ((line = in.readLine()) != null && line.length() != 0) {
			if (!first && !prevNoEmpty)
				out.append("\n");
			first = false;
			int sizeNeedle = Integer.parseInt(line.trim());
			String needle = in.readLine().trim(), haystack = in.readLine().trim();
			ArrayList<Integer> coincidencias = KMP(haystack, needle);
			prevNoEmpty = coincidencias.isEmpty();
			for (Integer integer : coincidencias)
				out.append(integer + "\n");
		}
		System.out.print(out);
	}