def main(): N, K = map(int, input().split()) tot = N * (N + 1) // 2 if tot % K != 0: print("No") return if (N // K) % 2 == 1: print("No") return ans = [[] for _ in range(K)] value = 1 for i in range(N // K): rng = range(K) if i % 2 else reversed(range(K)) for j in rng: ans[j].append(value) value += 1 print("Yes") for a in ans: print(*a) return main()