#region Header #!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools from queue import PriorityQueue import bisect import heapq def input(): return sys.stdin.readline()[:-1] sys.setrecursionlimit(1000000) #endregion # _INPUT = """# paste here... # """ # sys.stdin = io.StringIO(_INPUT) def main(): N, K = map(int, input().split()) if (N-1) % (K+1) == 0: a = 1 else: a = 0 print(a) sys.stdout.flush() while True: n = int(input()) if n >= N: return a += K + 1 print(a) sys.stdout.flush() if __name__ == '__main__': main()