res = 0 for i in range(1000): n, k = map(int, input().split()) res += 1 if n % (k + 1) == 0 else 0 print(res)