#include #include using namespace std; constexpr int kN = int(2E5 + 10); #define PB push_back vector ans[kN]; int main() { int n, k, need, now; scanf("%d%d", &n, &k); if (n == 1 && k == 1) { printf("Yes\n1\n"); return 0; } if (n == k || (long long int) n * (long long int) (n + 1) % (k << 1) != 0) printf("No\n"); else { need = n / k; now = 1; if (need & 1) { for (int i = 1; i <= k; i++) ans[i].PB(i); for (int i = 1, j = 0; i <= k; i++, j += 2) { if (j >= k) j -= k; ans[i].PB(k * 3 - j); ans[i].PB((k * 3 + 3) / 2 + j - i); } need -= 3; now = k * 3 + 1; } while (need) { for (int i = 1; i <= k; i++) ans[i].PB(now++); for (int i = k; i >= 1; i--) ans[i].PB(now++); need -= 2; } need = n / k; printf("Yes\n"); for (int i = 1; i <= k; i++) { printf("%d", ans[i][0]); for (int j = 1; j < need; j++) printf(" %d", ans[i][j]); printf("\n"); } } }