#include 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 (n / k & 1) { int m = n / k; vector< vector > 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)); } } for (int i = 0; i < k; ++i) { res[i].push_back(n / 2 - k + i); res[i].push_back(n / 2 + (i + k / 2) % k); res[i].push_back(n / 2 + k + (2 * k + k / 2 - 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]; } } } }