#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, k; cin >> n >> k; if (n == 1) { cout << "Yes\n1\n"; return 0; } if (((long long)n * (n + 1) / 2) % k or k == n) { cout << "No\n"; return 0; } cout << "Yes\n"; if (k == 1) { for (int i = 0; i < n; ++i) { cout << i + 1 << " \n"[i == n - 1]; } return 0; } if (n / k & 1) { // assert(false); int m = n / k; vector< vector<int> > res(k); for (int i = 0; i < k; ++i) { for (int j = 0; j < (m - 3) / 2; ++j) { res[i].push_back(i * (m - 3) / 2 + j + 1); res[i].push_back(n - (i * (m - 3) / 2 + j)); } } int s = n / 2 - k / 2 + 1; for (int i = 0; i < k; ++i) { res[i].push_back(s - k + i); res[i].push_back(s + (k / 2 + i) % k); res[i].push_back(s + k + (2 * k - 1 - 2 * i) % k); } for (const auto& v : res) { for (int i = 0; i < m; ++i) { cout << v[i] << " \n"[i == m - 1]; } } } else { int m = n / k / 2; for (int i = 0; i < k; ++i) { for (int j = 0; j < m; ++j) { cout << m * i + j + 1 << ' ' << n - (m * i + j) << " \n"[j == m - 1]; } } } }