#include using namespace std; #define fst(t) std::get<0>(t) #define snd(t) std::get<1>(t) #define thd(t) std::get<2>(t) #define unless(p) if(!(p)) #define until(p) while(!(p)) using ll = long long; using P = std::tuple; const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1}; int N, M; int values[100100]; set

edges; bool can(){ if(M < N - 1){ // 非連結になってしまう return false; } if(M <= (N / 2) * ((N + 1) / 2)){ for(int i=1;i<=N;++i){ values[i] = i; if(i <= N / 2){ edges.emplace(i, N / 2 + i); }else{ edges.emplace(i, i < N ? i - N / 2 + 1 : 1); } } for(int i=1;edges.size()<=M&&i<=N/2;++i){ for(int j=1;edges.size()<=M&&j<=(N+1)/2;++j){ edges.emplace(i, N / 2 + j); } } return true; } // 三角形ができてしまうので残念 return false; } int main(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cin >> N >> M; if(can()){ std::cout << "YES" << std::endl; for(int i=1;i<=N;++i){ std::cout << values[i] << " \n"[i==N]; } for(const auto& p : edges){ int u, v; tie(u, v) = p; std::cout << u << " " << v << std::endl; } }else{ std::cout << "NO" << std::endl; } }