package _0942; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; public class Main { public void solve(BufferedReader stdin, PrintWriter stdout) throws NumberFormatException, IOException { String[] line = stdin.readLine().split(" "); int n = Integer.parseInt(line[0]); int k = Integer.parseInt(line[1]); if ((n * (n + 1) / 2) % k != 0) { stdout.println("No"); return; } int[][] m = new int[k + k - 1][n / k * 2]; for (int i = 0; i < n; i++) { m[i / (n / k)][i % (n / k)] = i + 1; m[i / (n / k)][i % (n / k) + n / k] = i + 1; if (0 <= m.length - i / (n / k) - 1) m[m.length - i / (n / k) - 1][i % (n / k)] = i + 1; if (0 <= m.length - i / (n / k) - 1) m[m.length - i / (n / k) - 1][i % (n / k) + n / k] = i + 1; } stdout.println("Yes"); for (int x = 0; x < k; x++) { List ans = new ArrayList<>(); for (int y = 0; y < n / k; y++) { ans.add(m[y][x + y]); } stdout.println(ans.stream().map(Objects::toString).collect(Collectors.joining(" "))); } } public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); PrintWriter stdout = new PrintWriter(System.out, false); new Main().solve(stdin, stdout); stdout.flush(); } }