#include #include #include #include #include #include #include #include using namespace std; int main() { int n, k; cin >> n >> k; int m = n / k; if(n == 1) { cout << "Yes" << endl; cout << 1 << endl; return 0; } if((n % 2 == 0 && m % 2 == 1) || m == 1) { cout << "No" << endl; return 0; } cout << "Yes" << endl; if(k == 1) { for(int i = 0; i < n; i++) { if(i) cout << " "; cout << i + 1; } cout << endl; return 0; } if(m % 2 == 0) { for(int i = 0; i < k; i++) { for(int j = 0; j < m; j++) { if(j) cout << " "; if(j % 2 == 0) cout << j * k + 1 + i; else cout << (j + 1) * k - i; } cout << endl; } } else { for(int i = 0; i < k; i++) { int a = 1 + i; int b = (k + 1) + (k / 2 + i) % k; int c = (k + (k + 1 + k / 2) + 2 * k + 1) - a - b; cout << a << " " << b << " " << c; for(int j = 3; j < m; j++) { cout << " "; if(j % 2 == 0) cout << j * k + 1 + i; else cout << (j + 1) * k - i; } cout << endl; } } return 0; }