#include "bits/stdc++.h" #define ALL(g) (g).begin(),(g).end() #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define RREP(i, x, n) for(int i = x; i >= n; i--) #define rrep(i, n) RREP(i,n,0) #define pb push_back #define show_table(n, k, table) rep(i,n){ rep(j,k) cout << table[i][j] << " "; cout << endl;} template void chmax(T& a,const T& b){a=max(a,b);} template void chmin(T& a,const T& b){a=min(a,b);} using namespace std; using ll = long long; using P = pair; using Pl = pair; using vi = vector; using vvi = vector; const int mod=1e9+7,INF=1<<30; const double EPS=1e-12,PI=3.1415926535897932384626; const ll lmod = 1e9+7,LINF=1LL<<60; const int MAX_N = 302; int main(){ int N,M; cin >> N >> M; int X,Y; X = (N+1)/2; Y = (N)/2; if(!(M>=N-1 && M<=X*Y)){ cout << "NO" << endl; return 0; } int rest = M - (N-1); int temp = X+1; rep(i,N){ if(i%2==1) cout << temp++ << " "; else cout << i/2+1 << " "; } cout << "" << endl; rep(i,N){ if(i!=N-1) cout << i+1 << " " << i+2 << endl; if(i!=N-1 && rest>0){ if(i%2==1){ for(int j=i+3;j