import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys import time from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines write=sys.stdout.write sys.setrecursionlimit(1000000) N,K=map(int,readline().split()) if K==1: print("Yes") print(*[x+1 for x in range(N)]) exit() if K%2==0 and N//K%2 or N==K: print("No") exit() def solve(N,K): if K==1: return [[x for x in range(N)]] if N==0: return [[] for k in range(K)] if N==3*K: return [[k,(K//2+k)%K+K,(K-1-2*k)%K+2*K] for k in range(K)] lst=solve(N-K*2,K) for i in range(N-K*2,N-K): lst[i-(N-K*2)].append(i) for i in range(N-K,N): lst[N-1-i].append(i) return lst print("Yes") for lst in solve(N,K): print(*[x+1 for x in lst])