import sys N, K = map(int, input().split()) if N * (N + 1) // 2 % K != 0: print('No') sys.exit() print('Yes') for i in range(K): a = [] for j in range(N // K): a.append(K * j + (i + j) % K + 1) print(*a)