#include #define rep(i, a) for (int i = 0; i < (a); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define repr(i, a) for (int i = (a) - 1; i >= 0; i--) #define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--) using namespace std; typedef long long ll; const ll inf = 1e9; const ll mod = 1e9 + 7; int main() { ll N, K; cin >> N >> K; bool win = N % (K + 1) != 1; if (!win) cout << 0 << endl; ll a = 0; for (int i = 0;; i++) { if (a >= N) break; if (win) { if (i % 2 == 0) { if (a == 0) { if (N % (K + 1) == 0) { cout << K << endl; } else { cout << (N % (K + 1)) - 1 << endl; } } else cout << (a + K) / (K + 1) * (K + 1) << endl; a = (a + K) / (K + 1) * (K + 1); } else { cin >> a; } } else { if (i % 2 == 0) { cin >> a; } else { cout << (a + K) / (K + 1) * (K + 1) << endl; a = (a + K) / (K + 1) * (K + 1); } } } }