from operator import itemgetter from itertools import * from bisect import * from collections import * from heapq import * import sys sys.setrecursionlimit(10 ** 6) def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def SI(): return sys.stdin.readline()[:-1] def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] int1 = lambda x: int(x) - 1 def MI1(): return map(int1, sys.stdin.readline().split()) def LI1(): return list(map(int1, sys.stdin.readline().split())) p2D = lambda x: print(*x, sep="\n") dij = [(1, 0), (0, 1), (-1, 0), (0, -1)] def main(): n,m=MI() if m3*n-4: print("NO") exit() bn=m-(n-1) uv=[] for i in range(bn+1):uv.append((i*2+1,i*2+2)) for i in range(bn):uv+=[(2*i+1,2*i+4),(2*i+2,2*i+3)] uv.append((1,2*bn+3)) for i in range(2*bn+4,n+1):uv.append((i-1,i)) #print(uv) aa=[-1]*n cnt=1 for i in range(bn+1): aa[i*2]=cnt cnt+=1 for i in range(bn+1): aa[i*2+1]=cnt cnt+=1 #print(aa) for i in range(2*bn+3,n,2): aa[i]=cnt cnt+=1 for i in range(2*bn+2,n,2): aa[i]=cnt cnt+=1 #print(aa) print("YES") print(*aa) for u,v in uv:print(u,v) main()