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,2), (3,4), (4,5), (4,5)] + [(6,7)]*(2*10**5+5) for i in ans[:Q]: print(*i) elif(K == 4 and Q == 5): print("Yes") ans = [(1,2), (1,2), (1,2), (3,4), (3,4)] for i in ans: print(*i) else: print("No")