import java.util.Scanner; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int a = sc.nextInt(); int x = 0; while(x < N){ if(a != 0) x = sc.nextInt(); if(N - x > K)x += K; else if(N - x < K)x += N - x - 1; if(N - x == 1){ ++x; System.out.println(x); break; } System.out.println(x); if(a == 0) x = sc.nextInt(); } } }