#include #include using lint = long long; void solve() { int n, m; std::cin >> n >> m; int n1 = n / 2, n2 = n - n1; if (m < n - 1 || lint(n1) * n2 < m) { std::cout << "NO\n"; return; } std::cout << "YES\n"; for (int i = 1; i <= n; ++i) std::cout << i << " "; std::cout << "\n"; for (int u = 1; u <= n1; ++u) { for (int d = 0; d <= 1; ++d) { int v = u + d; if (n2 < v) continue; std::cout << u << " " << v + n1 << "\n"; --m; } } for (int u = 1; u <= n1 && m > 0; ++u) { for (int v = 1; v <= n2 && m > 0; ++v) { if (0 <= v - u && v - u <= 1) continue; std::cout << u << " " << v + n1 << "\n"; --m; } } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }