/* * validator */ #include std::pair read() { int x = 0; char c; while (true) { c = std::getchar(); if (!std::isdigit(c)) { return std::pair(x, c); } x = 10 * x + c - '0'; } } int main() { char c; int n, k; std::tie(n, c) = read(); assert(c == ' '); std::tie(k, c) = read(); assert(c == '\n'); assert(std::getchar() == EOF); assert(1 <= k && k < n && n <= 200'000); if (k==1) { std::cout << 1 << '\n'; return 0; } std::vector> a(n+1); std::vector b = {1}; for (int i = 2; i <= n; i++) { auto&& v = a.at(i); int x = b.back(); auto transite = [&](int j) { int d = i - j; if (d <= k && (a.at(j).empty() || (a.at(j).size() == int{1} && a.at(j).front() == d))) { v.push_back(d); } }; transite(x); transite((i + x) / 2); if (int{1} != b.size()) { int y = b.at(b.size() - 2); transite(y + k + 1); transite((i + y) / 2); } std::sort(v.begin(), v.end()); v.resize(std::unique(v.begin(), v.end()) - v.begin()); if (v.empty()) b.push_back(i); } std::vector ans = a.at(n); if (ans.empty()) { std::cout << 0 << '\n'; } else { for (int x: ans) { std::cout << x << '\n'; } } }