#include #include #include using namespace std; int main() { int n, m; cin >> n >> m; if (m < n - 1 || m > 1LL * (n / 2) * ((n + 1) / 2)) { cout << "NO" << endl; return 0; } cout << "YES" << endl; for (int i = 0; i < n; i++) { if (i > 0) cout << ' '; cout << i + 1; } cout << endl; for (int j = 0; j < (n + 1) / 2; j++) { cout << 1 << ' ' << j + n / 2 + 1 << endl; m--; } for (int j = 1; j < n / 2; j++) { cout << n / 2 + 1 << ' ' << j + 1 << endl; m--; } for (int i = 1; i < n / 2; i++) { for (int j = 1; j < (n + 1) / 2 && m > 0; j++) { cout << i + 1 << ' ' << j + n / 2 + 1 << endl; m--; } } }