#include using namespace std::literals::string_literals; using i64 = std::int_fast64_t; using std::cout; using std::cerr; using std::endl; using std::cin; template std::vector make_v(size_t a){return std::vector(a);} template auto make_v(size_t a,Ts... ts){ return std::vector(ts...))>(a,make_v(ts...)); } int main() { i64 n, k; scanf("%lld%lld", &n, &k); i64 tmp = n / k, latte = n * (n + 1) >> 1; if(((tmp & 1) and !(k & 1)) or (tmp == 1)) { printf("No\n"); return 0; } int i = 1; std::vector> ans(k); while(tmp) { if(tmp & 1) { i--; int cnt = 0; for(int j = 1; j <= (k + 1) / 2; j++) { ans[cnt].push_back(i + (k - 2 * (j - 1))); ans[cnt].push_back(i + (k + (k + 1) / 2 + j - 1)); ans[cnt].push_back(i + (2 * k + j)); cnt++; } for(int j = (k + 1) / 2 + 1; j <= k; j++) { ans[cnt].push_back(i + (k - 1 - 2 * (j - (k + 1) / 2 - 1))); ans[cnt].push_back(i + (1 * k + j - (k + 1) / 2)); ans[cnt].push_back(i + (2 * k + j)); cnt++; } i += 3 * k + 1; tmp -= 3; } else { for(int j = 0; j < k; j++) ans[j].push_back(i++); for(int j = 0; j < k; j++) ans[k - j - 1].push_back(i++); tmp -= 2; } } printf("Yes\n"); for(auto v: ans) { for(auto e: v) printf("%d ", e); printf("\n"); } return 0; }