Q,K = list(map(int,input().split())) if(K >= 5 or (K == 4 and Q <= 4) or (K == 3 and Q <= 3) or (K == 2 and Q == 1)): print("Yes") ans = [(1,2), (1,3), (3,4), (4,5), (4,5)] + [(6,7)]*(2*10**5+5) for i in ans[:Q]: print(*i) else: print("No")