import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # 二部グラフが必要十分 N,M = map(int,read().split()) x = N//2 if M < N - 1 or M > x * (N-x): print('NO') exit() # 奇数を左に、偶数を右に置く E = [] for i in range(1,N): E.append((i,i+1)) rest = M - (N-1) i = 1 for i in range(1,N+1,2): if not rest: break for j in range(2,N+1,2): if abs(i-j) == 1: continue E.append((i,j)) rest -= 1 if not rest:break A = [0] * N A[1::2] = range((N+3)//2,N+1) A[::2] = range(1,(N+3)//2) print('YES') print(' '.join(map(str,A))) print('\n'.join('{} {}'.format(x,y) for x,y in E))