import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); ArrayList list = new ArrayList(); for(int i = n-1; i >= 0; i -= k+1) { list.add(i); } for(int i = list.size()-1; i >= 0; i--) { System.out.println(list.get(i)); int in = sc.nextInt(); if(in >= n) break; if(i > 0 && list.get(i-1) == in) { i--; } } } }