import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int x = Integer.parseInt(sa[1]); br.close(); int n4 = n % 4; if (n4 == 0) n4 = 4; int x4 = x % 4; int l = x - x4; int r = x - x4 + 4; int end = n - n4 + 8; if (8 <= x && x < 12) end += 4; for (int i = 8; i < end; i++) { if (l <= i && i < r) { continue; } System.out.println(i); } switch (n4) { case 1: System.out.println(x); break; case 2: if (x == 1) { System.out.println(2); System.out.println(3); } else { System.out.println(x % 2 == 0 ? x + 1 : x - 1); System.out.println(1); } break; case 3: if (x == 1) { System.out.println(3); System.out.println(5); System.out.println(7); } else if (x < 4) { System.out.println(x % 2 == 0 ? x + 1 : x - 1); System.out.println(6); System.out.println(7); } else { System.out.println(x % 2 == 0 ? x + 1 : x - 1); System.out.println(2); System.out.println(3); } break; default: if (x == 1) { System.out.println(1); System.out.println(2); System.out.println(4); System.out.println(6); } else if (x < 4) { System.out.println(x); System.out.println(1); System.out.println(4); System.out.println(5); } else { System.out.println(x); System.out.println(1); if (x4 < 2) { System.out.println(x - x4 + 2); System.out.println(x - x4 + 3); } else { System.out.println(x - x4 + 0); System.out.println(x - x4 + 1); } } } } }