/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.06 17:30:27 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; int k = n / 2; if (n - 1 > m || (ll)k * (n - k) < m) { puts("NO"); return 0; } puts("YES"); for (int i = 0; i < n; i++) { cout << i + 1 << " "; } cout << endl; for (int i = 0; i < k - 1; i++) { cout << i + 1 << " " << k + i + 1 << endl; cout << i + 1 << " " << k + i + 2 << endl; m -= 2; } cout << k << " " << k + k << endl; m--; if (n & 1) { cout << k << " " << k + k + 1 << endl; m--; } for (int i = 0; i < k; i++) { if (m == 0) break; for (int j = k; j < n; j++) { if (m == 0) break; if (k + i == j || k + i + 1 == j) continue; cout << i + 1 << " " << j + 1 << endl; m--; } } return 0; }