#include using namespace std; #define not_spindle_points 2 * (N - 2) - M int main(){ int N, M; cin >> N >> M; if(M < N - 1 || M > 2 * (N - 2)){ cout << "NO" << endl; return 0; } cout << "YES" << endl; if(M == N - 1){ string a_array_string = ""; for(int i = 0; i < N; i++){ if(i % 2){ a_array_string += to_string(N - i / 2) + " "; }else{ a_array_string += to_string(i / 2 + 1) + " "; } } a_array_string.pop_back(); cout << a_array_string << endl; for(int i = 0; i < M; i++){ cout << i + 1 << " " << i + 2 << endl; } }else{ string a_array_string = ""; for(int i = 0; i < not_spindle_points + 3; i++){ if(i % 2){ a_array_string += to_string(not_spindle_points + 3 - i / 2) + " "; }else{ a_array_string += to_string(i / 2 + 1) + " "; } } for(int i = not_spindle_points + 3; i < N; i++){ a_array_string += to_string(i + 1) + " "; } a_array_string.pop_back(); cout << a_array_string << endl; for(int i = 0; i < not_spindle_points + 2; i++){ cout << i + 1 << " " << i + 2 << endl; } for(int i = not_spindle_points + 3; i < N; i++){ cout << 1 << " " << i + 1 << endl; cout << i + 1 << " " << 3 << endl; } } }