#include #include #include #include #include using namespace std; int main() { int N, M; cin >> N >> M; int maxE, minE; minE = N - 1; maxE = 0; for (int i = 0; i <= N; i++)maxE += i / 2; if (M maxE)cout << "NO" << endl; else { cout << "YES" << endl; vectorans(N); int a = 1; for (int i = 0; i < N; i += 2)ans[i] = a++; for (int i = 1; i < N; i += 2)ans[i] = a++; for (int i = 0; i < N; i++) { if (i)cout << " "; cout << ans[i]; } cout << endl; M -= N - 1; for (int i = 0; i < N; i++) { cout << i + 1 << " " << i + 2 << endl; for (int j = i + 3; M && j < N; j++) { cout << i + 1 << " " << j + 1 << endl; M--; } } } return 0; }