#include #include #include #include #include using namespace std; typedef long long ll; ll N,M; int A[100010]; vector> ans; int main(){ cin >> N >> M; if(M,int> m; for(int i=1;i<=k;i++){ if(!(N%2==1 && i==k)){ ans.push_back({i,i+k}); m[{i,i+k}]++; } if(i!=1){ ans.push_back({i,i+k-1}); m[{i,i+k-1}]++; } } M -= N-1; assert(N-1==m.size()); int s_id = 1,b_id = k+1; while(M>0){ int a = s_id,b = b_id; if(a>b) swap(a,b); if(m.count({a,b})){ b_id++; if(b_id>N){ s_id++; b_id = k+1; } continue; } ans.push_back({a,b}); m[{a,b}]++; M--; b_id++; if(b_id>N){ s_id++; b_id = k+1; } } for(auto x:ans) cout << x.first << " " << x.second << endl; }