#include using namespace std; int n,m; int a[100100]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; int x = (n + 1) / 2; int y = n - x; if (n - 1 <= m && m <= 1ll * x * y) { cout << "YES" << '\n'; int num = 1; for (int i = 0; i < n; i += 2) { a[i] = num++; } for (int i = 1; i < n; i += 2) { a[i] = num++; } for (int i = 0; i < n; i++) { cout << a[i] << (i < n - 1 ? ' ' : '\n'); } for (int i = 0; i < n - 1; i++) { cout << i+1 << ' ' << i+2 << '\n'; } m -= n - 1; for (int i = 0; i < n; i += 2) { for (int j = 1; j < n; j += 2) { if (!m) return 0; if (abs(i - j) > 1) { cout << i+1 << ' ' << j+1 << '\n'; m--; } } } } else { cout << "NO" << '\n'; } return 0; }