package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var rdr = bufio.NewReaderSize(os.Stdin, 1000000) func main() { sc.Split(bufio.ScanWords) n, k := nextInt(), nextInt() if !(k >= n || n%(k+1) != 1) { fmt.Println(0) os.Stdout.Sync() } else { fmt.Println(1) } for { ans := nextInt() if ans >= n { return } fmt.Println(ans + (k + 1 - ans%(k+1))) os.Stdout.Sync() } } func nextLine() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(nextLine()) return i }