#include #include #include #include #include #include #include #include using namespace std; #define FOR(i, s, e) for (int i = (s); i <= (e); i++) int N; int M; int a[100001]; int MAX = 100000; int MIN = 1; stringstream result; int main() { cin >> N >> M; for (int i = 1; i <= N; i++) { if (i % 2 == 1) { a[i] = MAX; MAX--; } else { a[i] = MIN; MIN++; } if (i <= N - 1) { result << i << " " << i + 1 << endl; } } if (N - 1 > M) { cout << "NO" << endl; return 0; } int remain = M - (N - 1); if (remain <= 0) { cout << "YES" << endl; FOR(i, 1, N) cout << a[i] << " "; cout << endl; cout << result.str(); return 0; } for (int i = 1; i <= N; i++) { for (int j = i + 3; j <= N; j += 2) { result << i << " " << j << endl; remain--; if (remain <= 0) { cout << "YES" << endl; FOR(i, 1, N) cout << a[i] << " "; cout << endl; cout << result.str(); return 0; } } } cout << "NO" << endl; return 0; }