import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N,K = map(int,readline().split()) def solve(N,K): if N % 2 == 0: solve_even(N,K) else: solve_odd(N,K) def solve_even(N,K): if N % (K * 2) != 0: print('No') return A = list(range(1,N+1)) M = N // 2 pairs = ['{} {}'.format(x,y) for x,y in zip(A[:M], A[M:][::-1])] size = M // K print('Yes') for i in range(K): print(' '.join(pairs[i*size:i*size+size])) return def solve_odd(N,K): import numpy as np if N % K != 0 or N == K: print('No') return print('Yes') H = N // K A = np.arange(1,N+1).reshape(H,K) k = K // 2 A[1] = np.concatenate([A[1,k:], A[1,:k]]) A[2] = A[1,0] * 3 - A[0] - A[1] A[3::2] = A[3::2,::-1] A = A.T print('\n'.join(' '.join(map(str,row)) for row in A)) solve(N,K)