import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Scanner; import java.util.TreeSet; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int M = sc.nextInt(); if(M < N - 1){ System.out.println("NO"); return; } if(N == 3){ if(M >= 3){ System.out.println("NO"); return; } if(M == 2){ System.out.println("YES"); System.out.println("1 3 2"); System.out.println("1 2"); System.out.println("2 3"); return; } } if(M == N - 1){ System.out.println("YES"); System.out.print(100000); for(int i = 1; i < N; i++){ System.out.print(" " + i); } System.out.println(); for(int i = 1; i < N; i++){ System.out.println(1 + " " + (i + 1)); } return; } final int evenN = N / 2 * 2; final int evenM = ((evenN == N) ? M : M - 1) - evenN; int current_max = 100000; int current_min = 1; int[] as = new int[N]; if(evenN != N){ as[N - 1] = current_max--; } for(int i = 0; i < evenN; i++){ as[i] = i % 2 == 0 ? (current_min++) : (current_max--); } //System.out.println(Arrays.toString(as)); //System.out.println(evenM); int edge_count = 0; for(int start = 0; start < evenN && edge_count < evenM; start++){ int curr = start; while(true){ final int to = ((curr == start) ? curr + 3 : curr + 2) % evenN; final int to_next = (to + 1) % evenN; if(to_next == start){ break; } if(to < start){ break; } //System.out.println(start + " " + curr + " " + to); edge_count++; curr = to; } } if(edge_count != evenM){ System.out.println("NO"); return; } for(int i = 0; i < N; i++){ System.out.print((i == 0 ? "" : " ") + as[i]); } System.out.println(); for(int i = 0; i < evenN; i++){ final int from = i; final int to = (i + 1) % evenN; System.out.println((from + 1) + " " + (to + 1)); } if(evenN != N){ System.out.println(1 + " " + N); } edge_count = 0; for(int start = 0; start < evenN && edge_count < evenM; start++){ int curr = start; while(true){ final int to = ((curr == start) ? curr + 3 : curr + 2) % evenN; final int to_next = (to + 1) % evenN; if(to_next == start){ break; } if(to < start){ break; } System.out.println((start + 1) + " " + (to + 1)); //System.out.println(start + " " + curr + " " + to); edge_count++; curr = to; } } } }