#include<bits/stdc++.h>
using namespace std;

int main(){
    int N,K;
    scanf("%d%d",&N,&K);

    int m=(N-1)%(K+1);

    if(m==0)printf("0\n");
    else printf("%d\n",m);
    fflush(stdout);

    while(true){
        int res;
        scanf("%d",&res);

        if(res>=N)return 0;

        while(true){
            res++;
            if(res%(K+1)==m)break;
        }

        printf("%d\n",res);
        fflush(stdout);
    }
    return 0;
}