Last week, Hamed learned about a new type of equations in his math class called Modular Equations. Lets define i modulo j as the remainder of division of i by j and denote it by $i \operatorname{mod} j$. A Modular Equation, as Hamed's teacher described, is an equation of the form $a \operatorname{mod} x = b$ in which a and b are two non-negative integers and x is a variable. We call a positive integer x for which $a \operatorname{mod} x = b$ a solution of our equation.

Hamed didn't pay much attention to the class since he was watching a movie. He only managed to understand the definitions of these equations.

Now he wants to write his math exercises but since he has no idea how to do that, he asked you for help. He has told you all he knows about Modular Equations and asked you to write a program which given two numbers a and b determines how many answers the Modular Equation $a \operatorname{mod} x = b$ has.


-----Input-----

In the only line of the input two space-separated integers a and b (0 ≤ a, b ≤ 10^9) are given.


-----Output-----

If there is an infinite number of answers to our equation, print "infinity" (without the quotes). Otherwise print the number of solutions of the Modular Equation $a \operatorname{mod} x = b$.


-----Examples-----
Input
21 5

Output
2

Input
9435152 272

Output
282

Input
10 10

Output
infinity



-----Note-----

In the first sample the answers of the Modular Equation are 8 and 16 since $21 \operatorname{mod} 8 = 21 \operatorname{mod} 16 = 5$

Difficulty: MEDIUM_HARD
Tags: Number theory

Mathematics

Starter code:

Solutions:
(a, b) = map(int, input().split())
count = 0
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	for i in range(1, int((a - b) ** 0.5) + 1):
		if (a - b) % i == 0:
			if i > b:
				count += 1
			if (a - b) // i != i and (a - b) // i > b:
				count += 1
	print(count)


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	dif = a - b
	i = 1
	result = 0
	while i * i <= dif:
		if dif % i == 0:
			if i > b:
				result += 1
			if dif // i > b and i * i != dif:
				result += 1
		i += 1
	print(result)


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	cnt = 0
	p = 1
	c = a - b
	while p * p < c:
		if c % p == 0 and c // p > b:
			cnt += 1
			if p > b:
				cnt += 1
		p += 1
	if p * p == c and p > b:
		cnt += 1
	print(cnt)


import random
(a, b) = map(int, input().split())

def sums(s, l, b):
	if s > b:
		p = 1
		for x in l:
			p *= x[1] + 1
		return p
	if not l:
		return 0
	p = 0
	for i in range(l[0][1] + 1):
		p += sums(s * l[0][0] ** i, l[1:], b)
	return p

def naive(a, b):
	if a == b:
		return 'infinity'
	elif a < b:
		return 0
	else:
		count = 0
		for x in range(1, a + 1):
			if a % x == b:
				count += 1
		return count

def wise(a, b):
	if a == 1 and b == 0:
		return 1
	if a == b:
		return 'infinity'
	else:
		d = a - b
		factors = {}
		i = 2
		while i * i <= d:
			if d % i == 0:
				factors.setdefault(i, 0)
				factors[i] += 1
				d //= i
			else:
				i += 1
		factors.setdefault(d, 0)
		factors[d] += 1
		return sums(1, list(factors.items()), b)
print(wise(a, b))


(a, b) = map(int, input().split(' '))
if a == b:
	print('infinity\n')
else:
	(s, k) = (0, 1)
	while k * k <= a - b:
		s += ((a - b) % k == 0 and k > b) + ((a - b) % k == 0 and (a - b) // k > b and ((a - b) // k != k))
		k += 1
	print(s, '\n')


from __future__ import print_function
from collections import *
from sys import stdin
from heapq import *
from math import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
rr = lambda x: reversed(range(x))
mod = int(1000000000.0) + 7
inf = float('inf')
(a, b) = gil()
if a <= b:
	print('0' if a < b else 'infinity')
	exit()
a -= b
ans = 0
for i in range(1, int(sqrt(a)) + 1):
	if a % i:
		continue
	j = a // i
	if min(i, j) > b and i != j:
		ans += 2
	elif max(i, j) > b:
		ans += 1
print(ans)


import math
(n, m) = input().split(' ')
(n, m) = (int(n), int(m))
if n == m:
	print('infinity')
elif n < m:
	print(0)
else:
	temp = n - m
	lst = []
	for i in range(1, int(math.sqrt(temp)) + 1):
		if temp % i == 0:
			lst.append(i)
			x = int(temp / i)
			if i != x:
				lst.append(x)
	total = 0
	for i in lst:
		if n % i == m:
			total += 1
	print(total)


(a, b) = list(map(int, input().split()))
a2 = a - b
if a2 == 0:
	print('infinity')
else:
	Count = 0
	i = 1
	while i ** 2 <= a2:
		Count += (a2 % i == 0 and i > b) + (a2 % i == 0 and a2 // i > b and (i != a2 // i))
		i += 1
	print(Count)


from math import sqrt, ceil
(a, b) = map(int, input().split())
e = a - b
if e == 0:
	print('infinity')
elif e < 0:
	print(0)
else:
	i = 1
	marked = False
	t = e
	ans = 0
	down = 0
	while i < ceil(sqrt(e)):
		if e % i == 0:
			t = e // i
			if t > b:
				ans += 1
				if i <= b:
					down += 1
		if e // i <= b:
			marked = True
			break
		i += 1
	if not marked:
		ans = ans * 2 - down
		if sqrt(e) == ceil(sqrt(e)) and sqrt(e) != b:
			ans += 1
	print(ans)


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
else:
	(k, val) = (1, 0)
	while k * k <= a - b:
		if (a - b) % k == 0:
			val += sum((1 for x in {k, (a - b) // k} if x > b))
		k += 1
	print(val)


(a, b) = [int(x) for x in input().split()]
i = 1
a -= b
count = 0
if a == 0:
	print('infinity')
else:
	while i * i <= a:
		if a % i == 0:
			if i * i == a:
				count += 1
			else:
				count += 2
				if a // i <= b:
					count -= 1
			if i <= b:
				count -= 1
		i += 1
	print(count)


import sys
(a, b) = map(int, input().split())
d = a - b
if d == 0:
	print('infinity')
	sys.exit()
if d < 0:
	print(0)
	sys.exit()
import math
cnt = 0
for i in range(1, math.trunc(math.sqrt(d)) + 1):
	if d % i == 0:
		if i > b:
			cnt += 1
		if d / i != i and d / i > b:
			cnt += 1
print(cnt)


from math import floor, sqrt

def main():
	(a, b) = list(map(int, input().split()))
	if a == b:
		print('infinity')
	elif a < b:
		print(0)
	else:
		(res, ab) = (0, a - b)
		for x in range(1, floor(sqrt(ab)) + 1):
			if not ab % x:
				if x > b:
					res += 1
				if b * x < ab != x * x:
					res += 1
		print(res)

def __starting_point():
	main()
__starting_point()


arr = [int(x) for x in input().split()]
a = arr[0]
b = arr[1]
resp = 0
if a == b:
	resp = 'infinity'
if resp != 'infinity':
	x = a - b
	i = 1
	c = 0
	while i ** 2 < x:
		c += 1
		if x % i == 0:
			if i > b:
				resp += 1
			if x / i > b:
				resp += 1
		i += 1
	if i ** 2 == x and i > b:
		resp += 1
print(resp)


(a, b) = input().split(' ')
a = int(a)
b = int(b)
if a == b:
	print('infinity')
	exit()
ans = 0
aux = abs(a - b)
i = 1
while i ** 2 < aux:
	if aux % i == 0:
		if i > b:
			ans = ans + 1
		if int(aux / i) > b:
			ans = ans + 1
	i = i + 1
if aux == i * i and i > b:
	ans = ans + 1
print(ans)


def count(n, x):
	if n == 1 and x < 1:
		return 1
	res = 0
	for i in range(1, n):
		if i * i > n:
			break
		if n % i == 0:
			if i > x:
				res += 1
			if n // i > x and n // i != i:
				res += 1
	return res
(a, b) = (int(x) for x in input().split())
if a == b:
	print('infinity')
else:
	print(count(a - b, b))


(a, b) = [int(x) for x in input().split()]
import math
if b > a:
	print(0)
elif b == a:
	print('infinity')
else:
	contador = 0
	for i in range(1, int(math.sqrt(a)) + 1):
		if (a - b) % i == 0:
			if i > b and (a - b) / i > b:
				contador += 2
			elif i > b:
				contador += 1
			elif (a - b) / i > b:
				contador += 1
	if math.sqrt(a - b) % 1 == 0 and math.sqrt(a - b) > b:
		contador -= 1
	print(contador)


def main2(a, b):
	if a == b:
		print('infinity')
		return
	x = a - b
	if b != 0:
		if x // b == 1:
			print(x // b)
			return
		if x // b <= 0:
			print(0)
			return
	xx = [1]
	loop = 2
	while loop <= x:
		if x % loop == 0:
			x //= loop
			xx.extend([loop * j for j in xx if loop * j not in xx])
		else:
			loop += 1
		print(loop, x, xx)
	xx = [k for k in xx if k > b]
	print(len(xx))

def main3(a, b):
	from math import ceil, sqrt
	if a == b:
		print('infinity')
		return
	x = a - b
	if b != 0:
		if x // b == 1:
			print(x // b)
			return
		if x // b <= 0:
			print(0)
			return
	xx = []
	for i in range(b + 1, ceil(sqrt(x))):
		if x % i == 0:
			xx.append(i)
	print(len(xx))

def main(a, b, Test=False):
	from math import ceil, sqrt, floor
	if a == b:
		print('infinity')
		return
	if b > a:
		print('0')
		return
	x = a - b
	ans = 0
	for i in range(1, floor(sqrt(x)) + 1):
		if x % i == 0:
			if i * i == x:
				ans += i > b
			else:
				ans += (i > b) + (x // i > b)
				if Test:
					print(i, x // i, ans)
	print(ans)

def test():
	from mxn.timer import Timer, timer
	print()
	main(21, 5)
	main(10, 10)
	main(0, 1000)
	with Timer() as tm:
		main(9435152, 272)
	with Timer() as tm:
		main(325508499, 119510657)
	with Timer() as tm:
		main(1000000000, 6)
	main(11, 2, Test=0)
	main(15, 3, Test=1)

def main_input():
	(a, b) = map(int, input().split())
	main(a, b)
main_input()


import math
(a, b) = map(int, input().split())
xs = a - b
if xs < 0:
	print(0)
elif xs == 0:
	print('infinity')
else:
	x = int(math.sqrt(xs))
	count = 0
	for i in range(1, x + 1):
		if xs % i == 0:
			if a % i == b:
				count += 1
			if i * i != xs:
				ys = xs // i
				if a % ys == b:
					count += 1
	print(count)


import itertools
import math

def main():
	(a, b) = list(map(int, input().split()))
	if a == b:
		print('infinity')
		return
	if a < b:
		print(0)
		return
	a -= b
	n = 0
	for i in range(1, math.ceil(math.sqrt(a))):
		if a % i == 0:
			n += (i > b) + (a // i > b)
	if math.sqrt(a) % 1 == 0 and math.sqrt(a) > b:
		n += 1
	print(n)
main()


from itertools import chain
from math import sqrt, ceil

def factors(n):
	return set(chain(*((i, n // i) for i in range(1, int(sqrt(n) + 1)) if not n % i)))

def main(a, b):
	if a == b:
		print('infinity')
	elif a < b:
		print(0)
	else:
		facts = factors(a - b)
		print(len([f for f in facts if f > b]))
main(*[int(x) for x in input().split(' ')])


from math import *
(a, b) = list(map(int, input().split()))
if a == b:
	print('infinity')
	return
t = a - b

def primes_sieve(limit):
	limitn = limit + 1
	not_prime = [False] * limitn
	primes = []
	for i in range(2, limitn):
		if not_prime[i]:
			continue
		for f in range(i * 2, limitn, i):
			not_prime[f] = True
		primes.append(i)
	return primes
lst = primes_sieve(trunc(sqrt(10 ** 10 + 7)))

def factorize(n, primes):
	factors = []
	for p in primes:
		if p * p > n:
			break
		i = 0
		while n % p == 0:
			n //= p
			i += 1
		if i > 0:
			factors.append((p, i))
	if n > 1:
		factors.append((n, 1))
	return factors

def divisors(factors):
	div = [1]
	for (p, r) in factors:
		div = [d * p ** e for d in div for e in range(r + 1)]
	return div
dv = divisors(factorize(t, lst))
c = 0
for x in dv:
	if x > b:
		c += 1
print(c)


import math

def funcao(a, b):
	if a == b:
		return -1
	if a == 0:
		if b == 0:
			return -1
		else:
			return 0
	if a < b:
		return 0
	divisor = 1
	cont = 0
	while divisor <= math.sqrt(a - b):
		quociente = (a - b) / divisor
		if (a - b) % divisor == 0:
			if divisor > b:
				cont += 1
			if quociente != divisor and quociente > b:
				cont += 1
		divisor += 1
	return cont
entrada = input().split()
a = int(entrada[0])
b = int(entrada[1])
res = funcao(a, b)
if res == -1:
	print('infinity')
else:
	print(res)


import math
(a, b) = map(int, input().split())
l = []
if b == a:
	print('infinity')
elif b > a:
	print(0)
else:
	count = 0
	n = a - b
	n1 = n
	n = n + 1
	n = int(math.sqrt(n))
	for i in range(1, n + 1):
		if n1 % i == 0:
			x = n1 // i
			if i > b:
				l.append(i)
			if x > b:
				l.append(x)
	print(len(set(l)))


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p + p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	(a, b) = list(map(int, input().split()))
	if a == b:
		print('infinity')
		return
	if a < b:
		print(0)
		return
	m = a - b
	z = factors(m)
	c = 0
	for x in z:
		if x > b:
			c += 1
	print(c)
for _ in range(1):
	solve()


(a, b) = map(int, input().split())
n = a - b
if n < 0:
	print(0)
elif n == 0:
	print('infinity')
else:
	s = 0
	d = 1
	while d * d < n:
		if n % d == 0:
			if d > b:
				s += 1
			if n // d > b:
				s += 1
		d += 1
	q = n ** 0.5
	if q == int(q):
		if q > b:
			s += 1
	print(s)


import math
(a, b) = [int(i) for i in input().split()]
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:

	def FindAllDivisors(x, b):
		y = 1
		ans = []
		while y <= int(math.sqrt(x)):
			if x % y == 0:
				if y != int(x / y):
					if y > b:
						ans.append(y)
					if int(x / y) > b:
						ans.append(int(x / y))
				elif y == int(x / y) and y > b:
					ans.append(y)
			y += 1
		return len(ans)
	print(FindAllDivisors(a - b, b))


a = input().split(' ')
x1 = int(a[0])
y1 = int(a[1])
a1 = x1 - y1
if x1 == y1:
	print('infinity')
else:
	i = 1
	counter = 0
	while i ** 2 <= a1:
		counter += (a1 % i == 0 and i > y1) + (a1 % i == 0 and a1 // i > y1 and (i != a1 // i))
		i += 1
	print(counter)


(numero_a, numero_b) = map(int, input().split())
if numero_a > numero_b:
	numero_a -= numero_b
	aux = 1
	num_de_solucoes = 0
	while aux * aux <= numero_a:
		if numero_a % aux == 0:
			if aux > numero_b:
				num_de_solucoes += 1
			if numero_a / aux > numero_b and aux * aux != numero_a:
				num_de_solucoes += 1
		aux += 1
	print(num_de_solucoes)
elif numero_a == numero_b:
	print('infinity')
else:
	print(0)


import sys
(a, b) = map(int, input().split())
dis = a - b
if dis == 0:
	print('infinity')
else:
	res = 0
	x = 1
	while x ** 2 <= dis:
		if dis % x == 0 and x > b:
			res += 1
		if dis % x == 0 and dis // x > b and (x ** 2 != dis):
			res += 1
		x += 1
	print(res)


from math import sqrt

def factors(n):
	root = sqrt(n)
	start = int(root)
	if n % 2 == 0:
		step = -1
	else:
		step = -2
		start = start // 2 * 2 + 1
	if root.is_integer():
		yield int(root)
		start += step
	for x in range(start, 0, step):
		if n % x == 0:
			yield x
			yield (n // x)
(a, b) = map(int, input().split())
if b > a:
	print('0')
elif b == a:
	print('infinity')
else:
	arr = list(factors(a - b))
	count = 0
	for i in arr:
		if i > b:
			count += 1
	print(count)


(a, b) = map(int, input().split())
a -= b
i = 1
ans = 0
while i ** 2 <= a:
	if a % i != 0:
		i += 1
		continue
	if i > b:
		ans += 1
	if i * i != a and a // i > b:
		ans += 1
	i += 1
print(ans if a + b != b else 'infinity')


def raiz(n):
	raiz = n ** 0.5
	while raiz * raiz < n:
		raiz += 1
	return raiz
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif b > a:
	print(0)
else:
	resp = 0
	n = 1
	m = a - b
	while n <= raiz(m) and m / n > b:
		if m % n == 0:
			resp += 1
			if n > b and m / n != n:
				resp += 1
		n += 1
	print(resp)


(a, b) = map(int, input().split())
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:
	i = 1
	n = 0
	while i * i <= a - b:
		if (a - b) % i == 0:
			if i > b:
				n += 1
			if (a - b) / i > b and i * i != a - b:
				n += 1
		i += 1
	print(n)


(a, b) = map(int, input().split())
if b > a:
	print(0)
elif a == b:
	print('infinity')
else:
	ds = []
	r = int((a - b) ** 0.5)
	if a - b == r * r:
		ds.append(r)
	else:
		r += 1
	for d in range(1, r):
		if (a - b) % d == 0:
			ds.append(d)
			ds.append((a - b) // d)
	print(len([d for d in ds if d > b]))


a = input().split()
n = int(a[0])
m = int(a[1])
ans = 0
if n < m:
	print('0')
elif n == m:
	print('infinity')
else:
	i = 1
	n = n - m
	while i * i < n:
		if n % i == 0:
			if i > m:
				ans = ans + 1
			if n / i > m:
				ans = ans + 1
		i = i + 1
	s = int(n ** 0.5)
	if s ** 2 == n and s > m:
		ans = ans + 1
	print(ans)


(a, b) = map(int, input().split())
x = a - b
if x == 0:
	print('infinity')
elif x < 0:
	print(0)
else:
	i = 1
	cont = 0
	while i * i <= x:
		if x % i == 0:
			if a % i == b:
				cont += 1
			if x / i != i and a % (x / i) == b:
				cont += 1
		i += 1
	print(cont)


import math
(a, b) = tuple((int(i) for i in input().split()))
k = a - b
if k == 0:
	print('infinity')
elif k < 0:
	print(0)
else:
	ans = 0
	for i in range(1, math.ceil(math.sqrt(k))):
		if k % i == 0:
			if i > b:
				ans += 1
			if k // i > b and k // i != i:
				ans += 1
	if math.floor(math.sqrt(k)) ** 2 == k and math.floor(math.sqrt(k)) > b:
		ans += 1
	print(ans)


inp = input().split(' ')
a = int(inp[0])
b = int(inp[1])
diff = a - b
if a == b:
	print('infinity')
elif diff < 0:
	print(0)
else:
	l = []
	out = 1
	for x in range(2, int(diff ** (1 / 2)) + 1):
		num = 0
		y = diff / x
		while y == int(y):
			num += 1
			diff /= x
			y /= x
		if num != 0:
			l.append([x, num])
			out *= num + 1
		if diff < x:
			break
	if diff != 1:
		l.append([int(diff), 1])
		out *= 2
	if b == 0:
		print(out)
	else:
		flessb = [1]
		for pair in l:
			newl = []
			for x in flessb:
				y = x
				for exp in range(pair[1] + 1):
					if y <= b:
						newl.append(y)
						y *= pair[0]
					else:
						break
			flessb = set(newl)
		print(int(out - len(flessb)))


import sys
from math import gcd, sqrt, ceil, log2
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
import math
sys.setrecursionlimit(2 * 10 ** 5 + 10)
import heapq
from itertools import permutations
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_sum(bit, i):
	s = 0
	i += 1
	while i > 0:
		s += bit[i]
		i -= i & -i
	return s

def update(bit, n, i, v):
	i += 1
	while i <= n:
		bit[i] += v
		i += i & -i

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def primeFactors(n):
	sa = set()
	sa.add(n)
	while n % 2 == 0:
		sa.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			sa.add(i)
			n = n // i
	return sa

def seive(n):
	pri = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if pri[p] == True:
			for i in range(p * p, n + 1, p):
				pri[i] = False
		p += 1
	return pri

def check_prim(n):
	if n < 0:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def getZarr(string, z):
	n = len(string)
	(l, r, k) = (0, 0, 0)
	for i in range(1, n):
		if i > r:
			(l, r) = (i, i)
			while r < n and string[r - l] == string[r]:
				r += 1
			z[i] = r - l
			r -= 1
		else:
			k = i - l
			if z[k] < r - i + 1:
				z[i] = z[k]
			else:
				l = i
				while r < n and string[r - l] == string[r]:
					r += 1
				z[i] = r - l
				r -= 1

def search(text, pattern):
	concat = pattern + '$' + text
	l = len(concat)
	z = [0] * l
	getZarr(concat, z)
	ha = []
	for i in range(l):
		if z[i] == len(pattern):
			ha.append(i - len(pattern) - 1)
	return ha

def mergeIntervals(arr):
	arr.sort(key=lambda x: x[0])
	m = []
	s = -10000
	max = -100000
	for i in range(len(arr)):
		a = arr[i]
		if a[0] > max:
			if i != 0:
				m.append([s, max])
			max = a[1]
			s = a[0]
		elif a[1] >= max:
			max = a[1]
	if max != -100000 and [s, max] not in m:
		m.append([s, max])
	return m

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def sol(n):
	seti = set()
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			seti.add(n // i)
			seti.add(i)
	return seti
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
	exit()
if b > a:
	print(0)
	exit()
z = a - b
k = sol(a - b)
ans = 0
for i in k:
	if a % i == b:
		ans += 1
print(ans)


entrada = input().split()
a = int(entrada[0])
b = int(entrada[1])
if a == b:
	print('infinity')
else:
	a -= b
	result = 0
	i = 1
	while i * i <= a:
		if a % i == 0:
			if i > b:
				result += 1
			if a // i != i and a // i > b:
				result += 1
		i += 1
	print(result)


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
	exit()
elif a < b:
	print(0)
	exit()
else:
	x = a - b
	ans = 0
	for i in range(1, int(x ** 0.5) + 1):
		if x % i == 0 and i > b:
			ans += 1
		if i * i < x:
			tmp = x // i
			if x % tmp == 0 and tmp > b:
				ans += 1
print(ans)


from math import sqrt
from functools import reduce

def factorNumber(x, b):
	factors = []
	for i in range(1, int(sqrt(x)) + 1):
		if x % i == 0:
			factors.append(i)
			if x // i != i:
				factors.append(x // i)
	count = 0
	for i in factors:
		if i > b:
			count += 1
	print(count)
(a, b) = list(map(int, input().split()))
answers = 0
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	factorNumber(a - b, b)


import sys
(a, b) = [int(n) for n in input().split()]
x = 1
c = 0
if a == b:
	print('infinity')
	sys.exit(0)
while x ** 2 <= a - b:
	if (a - b) % x == 0:
		if x > b:
			c += 1
		if x ** 2 != a - b and (a - b) / x > b:
			c += 1
	x += 1
print(c)


from math import sqrt as S
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
	exit()
if a < b:
	print(0)
	exit()
curr = a - b
div = []
for i in range(1, int(S(curr)) + 1):
	if curr % i == 0:
		div.append(i)
		if i != curr // i:
			div.append(curr // i)
cnt = 0
for i in div:
	if a % i == b:
		cnt += 1
print(cnt)


import math
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
else:
	num = abs(a - b)
	i = 1
	count = 0
	while i < int(math.sqrt(num)) + 1:
		if num % i == 0:
			if i > b:
				count += 1
			if num / i > b and i * i != num:
				count += 1
		i += 1
	print(count)


import fractions
import math

def lcm(a, b):
	return a * b / fractions.gcd(a, b)

def make_divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors

def main():
	(a, b) = map(int, input().split())
	if a < b:
		print(0)
	elif a == b:
		print('infinity')
	else:
		l = make_divisors(a - b)
		ans = 0
		for n in l:
			if a % n == b:
				ans += 1
		print(ans)
main()


(a, b) = map(int, input().split(' '))
diff = a - b
if a == 0 or b == 0 or diff == 0 or (b > a):
	if b > a:
		print(0)
	elif a == 0 and b == 0:
		print('infinity')
	elif a == 0:
		print(0)
	elif b == 0:
		factors = []
		for i in range(1, int(diff ** 0.5) + 1):
			if diff % i == 0:
				factors.append(i)
				factors.append(int(diff / i))
		factors = list(set(factors))
		facts = [i for i in factors if i > b]
		print(len(facts))
	else:
		print('infinity')
else:
	b = b % a
	diff = a - b
	factors = []
	for i in range(1, int(diff ** 0.5) + 1):
		if diff % i == 0:
			factors.append(i)
			factors.append(int(diff / i))
	factors = list(set(factors))
	facts = [i for i in factors if i > b]
	print(len(facts))


def input_split(f):
	return map(f, input().split())

def main():
	(a, b) = input_split(int)
	if a == b:
		print('infinity')
	elif a < b:
		print(0)
	else:
		(s, a) = (0, a - b)
		y = int(a ** 0.5)
		for x in range(1, y + 1):
			if a % x == 0:
				if x > b:
					s += 1
				if a > b * x:
					s += 1
		if y > b and y * y == a:
			s -= 1
		print(str(s))
main()


(a, b) = map(int, input().split())
r = 0
c = 1
v = a - b
while c * c <= v:
	if v % c == 0:
		r += (c > b) + (c * c < v and v > b * c)
	c += 1
print('infinity' if a == b else r)


var = input()
(a, b) = var.split()
a = int(a)
b = int(b)
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	a -= b
	i = 1
	result = 0
	while i * i <= a:
		if a % i == 0:
			if i > b:
				result += 1
			if a / i > b and i * i != a:
				result += 1
		i += 1
	print(result)


(a, b) = [int(x) for x in input().split()]
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:
	x = a - b
	i = 1
	ans = 0
	while i * i <= x:
		if not x % i:
			if x // i == i and i > b:
				ans += 1
			else:
				if i > b:
					ans += 1
				if x // i > b:
					ans += 1
		i += 1
	print(ans)


(a, b) = [int(i) for i in input().split()]
o = a - b
sum = 0
l = 1
if o > 0:
	for i in range(1, int(o ** 0.5) + l):
		if o % i == 0:
			if o // i > b and i > b:
				sum += 2
				if i == o // i:
					sum -= 1
			if o // i > b and i <= b or (o // i <= b and i > b):
				sum += 1
if o == 0:
	print('infinity')
else:
	print(sum)


(x, y) = list(map(int, input().split()))
n = x - y
j = n
c = 0
if j < 0:
	print(c)
elif j == 0:
	print('infinity')
else:
	result_set = set()
	sqrtn = int(n ** 0.5)
	for i in range(1, sqrtn + 1):
		(q, r) = (n / i, n % i)
		if r == 0:
			if q > y:
				result_set.add(q)
			if i > y:
				result_set.add(i)
	print(len(result_set))


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
else:
	res = 0
	if a > b:
		dif = a - b
		i = 1
		while 1:
			if dif % i == 0:
				if dif // i > b and dif // i is not i:
					res += 1
				if i > b:
					res += 1
			i += 1
			if i * i > dif:
				break
	print(res)


x = input('').split(' ')
a = int(x[0])
b = int(x[1])
list = []
answer = 0
if a == b:
	print('infinity')
else:
	value = 1
	while value ** 2 <= a - b:
		if (a - b) % value == 0:
			list.append(value)
			if value != (a - b) / value:
				list.append((a - b) / value)
		value = value + 1
	for value in list:
		if value > b:
			answer = answer + 1
	print(answer)


(a, r) = map(int, input().split())
(ans, c, kx) = (0, 1, a - r)
while c * c <= kx:
	if not kx % c:
		ans += (c > r) + (c * c < kx and kx > c * r)
	c += 1
print((ans, 'infinity')[a == r])


(a, b) = list(map(int, input().split()))
if a < b:
	print(0)
elif a == b:
	print('infinity')
elif a > b:
	cnt = 0
	for i in range(1, int((a - b) ** 0.5) + 1):
		if (a - b) % i == 0:
			if i > b:
				cnt += 1
			if (a - b) / i > b and i * i != a - b:
				cnt += 1
	print(cnt)


(a, b) = list(map(int, input().split()))
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:
	num = a - b
	limit = int(num ** 0.5)
	divisors = 0
	for i in range(1, limit + 1):
		if num % i == 0:
			divisors += 1
			if i <= b or i == num // i:
				divisors -= 1
			if num // i > b:
				divisors += 1
	print(divisors)


from math import sqrt
(n_to_mod, remainder) = input().split()
n_to_mod = int(n_to_mod)
remainder = int(remainder)

def verify_n_divisors(array_div_population):
	if array_div_population == []:
		return 0
	n_of_divisors = 1
	for idx_div in range(len(array_div)):
		n_of_divisors *= array_div_population[idx_div] + 1
	return n_of_divisors

def is_at_array_div(divisor, array_div, array_div_population):
	for div_idx in range(len(array_div)):
		if divisor == array_div[div_idx]:
			array_div_population[div_idx] += 1
			return
	array_div_population.append(1)
	array_div.append(divisor)

def get_divisors(array_div, array_div_population):
	divisors = [1]
	for div_idx in range(len(array_div)):
		divisors = multiply_fact_n_times(divisors, array_div[div_idx], array_div_population[div_idx])
	return divisors

def multiply_fact_n_times(divisors, factor, n_times):
	new_divisors = []
	for div in divisors:
		result = div * factor
		new_divisors.append(result)
	divisors = divisors + new_divisors
	while n_times - 1 > 0:
		final_divisors = []
		for div in new_divisors:
			result = div * factor
			final_divisors.append(result)
		divisors = divisors + final_divisors
		new_divisors = final_divisors
		n_times -= 1
	return divisors
if n_to_mod == remainder:
	print('infinity')
elif n_to_mod <= remainder:
	print(0)
else:
	array_div = []
	array_div_population = []
	factor_count = 2
	plus_two = False
	first_module = n_to_mod - remainder
	max_size = sqrt(first_module)
	count_modular_times = 0
	module_controller = 2
	while first_module != 1:
		if first_module % factor_count == 0:
			first_module //= factor_count
			is_at_array_div(factor_count, array_div, array_div_population)
		else:
			if not plus_two:
				factor_count += 1
				plus_two = True
			else:
				factor_count += 2
			if factor_count > max_size:
				factor_count = first_module
	divisors = list(sorted(get_divisors(array_div, array_div_population)))
	for divisor in divisors:
		if divisor > remainder:
			count_modular_times += 1
	print(count_modular_times)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(a, b) = list(map(int, input().split()))
if a < b:
	print(0)
elif a == b:
	print('infinity')
elif a > b:
	cnt = 0
	for i in range(1, int((a - b) ** 0.5) + 1):
		if (a - b) % i == 0:
			if i > b:
				cnt += 1
			if (a - b) / i > b and i * i != a - b:
				cnt += 1
	print(cnt)


tmp = input().split()
a = int(tmp[0])
b = int(tmp[1])
a -= b
if a == 0:
	print('infinity')
else:
	ans = 0
	i = 1
	while i * i < a:
		if a % i == 0:
			if i > b:
				ans += 1
			if a / i > b:
				ans += 1
		i += 1
	if i * i == a and i > b:
		ans += 1
	print(ans)


from math import sqrt
(a, b) = map(int, input().split())
sub = abs(a - b)
if sub == 0:
	print('infinity')
elif b > a:
	print(0)
else:
	i = 1
	cont = 0
	while i <= sqrt(sub):
		if sub % i == 0:
			if i > b and a % i == b:
				cont += 1
			if sub // i != i and a % (sub // i) == b:
				cont += 1
		i += 1
	print(cont)


(a, b) = map(int, input().split())
if b > a:
	print(0)
elif b == a:
	print('infinity')
else:
	c = a - b
	l = []
	for i in range(1, int(c ** 0.5) + 1):
		if c % i == 0:
			l.append(i)
			if i != c // i:
				l.append(c // i)
	ans = 0
	for i in l:
		if a % i == b:
			ans += 1
	print(ans)


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
	exit()
(a, res) = (a - b, 0)
for i in range(1, a + 1):
	if i * i > a:
		break
	if a % i != 0:
		continue
	if i != a // i and a // i > b:
		res += 1
	if i > b:
		res += 1
print(res)


def printDivisors(n):
	i = 1
	l = []
	c = 0
	while i * i <= n:
		if n % i == 0:
			if n / i == i:
				l.append(i)
				c += 1
			else:
				l.append(i)
				l.append(n // i)
				c += 2
		i = i + 1
	return (l, c)
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
else:
	if a == 0:
		print(0)
		exit()
	(l, c) = printDivisors(a - b)
	ans = 0
	for p in l:
		if p <= b:
			ans += 1
	print(c - ans)


import math
(a, b) = map(int, input().rstrip().split())
if a == b:
	print('infinity')
if a < b:
	print(0)
if a != b and a > b:
	total = 0
	c = a - b
	x = 0
	for i in range(1, math.floor(math.sqrt(c)) + 1):
		if c % i == 0:
			if i > b:
				total += 1
			if i != int(c / i) and int(c / i) > b:
				total += 1
	print(total)


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
	exit(0)
x = abs(a - b)
ans = 0
for xx in range(1, int(x ** 0.5) + 1):
	if x % xx == 0:
		if a % xx == b:
			ans += 1
		if xx * xx != x:
			if a % (x // xx) == b:
				ans += 1
print(ans)


import collections, math
(a, b) = [int(x) for x in input().split()]
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:
	a -= b
	factors = collections.defaultdict(int)
	i = 2
	while i * i <= a:
		while a % i == 0:
			factors[i] += 1
			a //= i
		i += 1
	if a > 1:
		factors[a] += 1
	result = 0
	n = len(factors)
	if n > 0:
		fkey = list(factors.keys())
		fval = list(factors.values())
		cur = [0] * n
		while True:
			cur[0] += 1
			for i in range(n - 1):
				if cur[i] > fval[i]:
					cur[i] = 0
					cur[i + 1] += 1
			if cur[n - 1] > fval[n - 1]:
				break
			f = 1
			for i in range(n):
				f *= pow(fkey[i], cur[i])
			if f > b:
				result += 1
	if b == 0:
		result += 1
	print(result)


import math
import collections

def multipliers(x):
	divisors = []
	divisor = 2
	stop = math.sqrt(x)
	while x != 1 and divisor <= stop:
		if x % divisor == 0:
			x //= divisor
			divisors.append(divisor)
		else:
			divisor += 1
	if x != 1:
		divisors.append(x)
	return divisors

def count(muls, bound, viewed=None, x=1):
	viewed = viewed or set()
	for (i, mul) in enumerate(muls):
		nx = x * mul
		if nx not in viewed:
			viewed.add(nx)
			if nx > bound:
				yield 1
			yield from count(muls[:i] + muls[i + 1:], bound, viewed, nx)
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif b > a or a == 0:
	print(0)
elif (a, b) == (1, 0):
	print(1)
else:
	muls = multipliers(a - b)
	r = sum(count(muls, b))
	print(r if b else r + 1)


import math
line = input().split()
a = int(line[0])
b = int(line[1])
if a == 0 and b == 0:
	print('infinity')
elif a == 0:
	print('0')
elif a == b:
	print('infinity')
elif a < b:
	print('0')
else:
	c = a - b
	out = 0
	cek = [1]
	dum = c
	if dum % 2 == 0:
		cek.append(2)
		while dum % 2 == 0:
			dum /= 2
			for i in range(len(cek)):
				cek.append(cek[i] * 2)
	cek = list(set(cek))
	border = int(math.sqrt(dum))
	for i in range(3, border + 1, 2):
		if dum % i == 0:
			cek.append(i)
			while dum % i == 0:
				dum /= i
				for j in range(len(cek)):
					cek.append(cek[j] * i)
	dum = int(dum)
	if dum != 0:
		for j in range(len(cek)):
			cek.append(cek[j] * dum)
	cek = list(set(cek))
	cek.sort()
	for i in cek:
		if i == 0:
			continue
		if c % i == 0:
			result = c / i
			if result <= b:
				break
			out += 1
	print(out)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
(a, b) = list(map(int, input().split()))
if a < b:
	print(0)
elif a == b:
	print('infinity')
elif a > b:
	cnt = 0
	for i in range(1, int((a - b) ** 0.5) + 1):
		if (a - b) % i == 0:
			if i > b:
				cnt += 1
			if (a - b) / i > b and i * i != a - b:
				cnt += 1
	print(cnt)


import math
(a, b) = map(int, input().split())
k = 0
if a == b:
	print('infinity')
elif b > a:
	print(0)
else:
	i = 1
	while i * i <= a - b:
		if (a - b) % i == 0 and i > b:
			k += 1
		if (a - b) // i > b and (a - b) % i == 0 and (i * i != a - b):
			k += 1
		i += 1
	print(k)


import math
(a, b) = map(int, input().split(' '))
if a == b:
	print('infinity')
elif b > a:
	print(0)
else:
	pivor = a - b
	multipos = 0
	for i in range(1, int(math.sqrt(pivor)) + 1):
		if pivor % i == 0:
			if pivor / i == i and i > b or (i <= b and pivor / i > b):
				multipos += 1
			elif pivor / i > b and i > b:
				multipos += 2
	print(multipos)


import math
(n, m) = map(int, input().split())
a = n - m
ans = 0
if m == n:
	print('infinity')
	exit()
if a < 0:
	print(0)
	exit()
for i in range(1, int(math.sqrt(a)) + 1, 1):
	if a % i == 0:
		a1 = i
		a2 = a // i
		if a1 == a2 and a1 > m:
			ans += 1
			continue
		if a1 > m:
			ans += 1
		if a2 > m:
			ans += 1
print(ans)


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	c = a - b
	s = [c // i for i in range(1, min(c, 40000)) if a % (c // i) == b] + [i for i in range(1, 40000) if a % i == b]
	s = set(s)
	print(len(s))


(N, T) = map(int, input().split())
if N < T:
	print(0)
elif N == T:
	print('infinity')
else:
	N -= T
	i = 1
	R = 0
	while i * i <= N:
		if N % i == 0:
			if i > T:
				R += 1
			if N / i > T and i * i != N:
				R += 1
		i += 1
	print(R)


def div(num):
	count = 0
	i = 1
	while i * i <= num:
		if num % i == 0:
			if num / i == i and i > b:
				count += 1
			else:
				if i > b:
					count += 1
				if num / i > b:
					count += 1
		i += 1
	return count
(a, b) = map(int, input().split())
sub = a - b
if sub == 0:
	print('infinity')
elif sub < 0:
	print(0)
else:
	print(div(a - b))


import math
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
	exit()
if b > a:
	print(0)
	exit()

def fact(x):
	ans = []
	for i in range(1, int(math.sqrt(x)) + 1):
		if i == x // i:
			ans.append(i)
		else:
			ans.append(i)
			ans.append(x // i)
	return ans
ans = fact(a - b)
count = 0
for i in range(len(ans)):
	if ans[i] > b:
		if a % ans[i] == b:
			count += 1
print(count)


from sys import stdin
(a, b) = map(int, stdin.readline().split())
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	ans = 0
	i = 1
	bb = b
	b = a - b
	while i * i <= b:
		if b % i == 0:
			if i * i == b and i > bb:
				ans += 1
			else:
				if i > bb:
					ans += 1
				if b // i > bb:
					ans += 1
		i += 1
	print(ans)


(a, b) = [int(n) for n in input().split()]
c = a - b
x = 1
z = 0
if a == b:
	print('infinity')
else:
	while x ** 2 <= c:
		if c % x == 0:
			if x > b:
				z += 1
			if x ** 2 != c and c / x > b:
				z += 1
		x += 1
	print(z)


def printDivisors(n):
	ans = []
	for i in range(1, int(n ** 0.5 + 1)):
		if n % i == 0:
			if n // i == i:
				ans.append(i)
			else:
				ans.append(i)
				ans.append(n // i)
	return sorted(ans)
(a, b) = map(int, input().split())
print('infinity') if a == b else print(0) if a < b else print(sum((i > b for i in printDivisors(a - b))))


n = input().split(' ')
a = int(n[0])
b = int(n[1])
if a == b:
	print('infinity')
elif b > a:
	print(0)
else:
	k = a - b
	cont = 0
	i = 1
	while i * i <= k:
		if k % i == 0:
			if k / i == i and i > b:
				cont += 1
			else:
				if i > b:
					cont += 1
				if k / i > b:
					cont += 1
		i += 1
	print(cont)


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
else:
	n = a - b
	i = 1
	k = 0
	while i ** 2 <= n:
		if n % i == 0:
			if i > b:
				k += 1
			if i ** 2 != n:
				if n // i > b:
					k += 1
		i += 1
	print(k)


import bisect
from itertools import accumulate, count
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	for i in range(2, len(primes)):
		if primes[i] == True:
			prime.append(i)
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return fac

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)

def NcR(n, r):
	p = 1
	k = 1
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			p *= n
			k *= r
			m = math.gcd(p, k)
			p //= m
			k //= m
			n -= 1
			r -= 1
	else:
		p = 1
	return p

def Log2(x):
	if x == 0:
		return False
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))
(a, b) = map(int, input().split())
if a == 0 and b != 0:
	print(0)
elif b > a:
	print(0)
elif a == b:
	print('infinity')
else:
	c = a - b
	fac = factors(c)
	count = 0
	for i in range(0, len(fac)):
		if fac[i] > b:
			count += 1
	print(count)


import time
(a, b) = (int(i) for i in input().split())
start = time.time()
ans = 0
if a == b:
	ans = 'infinity'
elif a > b:
	i = 1
	max = (a - b) ** 0.5
	while i <= max:
		if divmod(a - b, i)[1] == 0:
			if i > b:
				ans += 1
			buf = (a - b) // i
			if buf > b and buf != i:
				ans += 1
		i += 1
print(ans)
finish = time.time()


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif a < b:
	print('0')
else:
	ans = 0
	for j in range(1, a - b + 1):
		if j * j > a - b:
			break
		if (a - b) / j == j and (a - b) % j == 0 and (j > b):
			ans += 1
		elif (a - b) % j == 0:
			if (a - b) / j > b:
				ans += 1
			if j > b:
				ans += 1
	print(ans)


(a, b) = input().split()
a = int(a)
b = int(b)
if a == b:
	print('infinity')
elif b > a:
	print(0)
else:
	quant = 0
	d = a - b
	i = 1
	while i * i <= d:
		if d % i == 0:
			if d / i == i and i > b:
				quant += 1
			else:
				if i > b:
					quant += 1
				if d / i > b:
					quant += 1
		i += 1
	print(quant)


(a, b) = map(int, input().split())
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:
	l = []
	k = a - b
	use = set()
	for x in range(1, int(k ** 0.5) + 1):
		if k % x == 0 and x not in use:
			use.add(x)
			l.append(x)
			if k // x not in use:
				use.add(k // x)
				l.append(k // x)
	l.sort()
	cnt = 0
	for x in l:
		if x > b:
			cnt += 1
	print(cnt)


(n, x) = input().split(' ')
n = int(n)
x = int(x)

def solve(n, x):
	n = n - x
	i = 1
	counter = 0
	while i * i <= n:
		if n % i == 0:
			if i > x:
				counter += 1
			if n / i > x and i * i != n:
				counter += 1
		i = i + 1
	return counter
if n == x:
	print('infinity')
elif n < x:
	print(0)
else:
	print(solve(n, x))


def qtd_x(a, b):
	x = 0
	aux = a - b
	i = 1
	while i * i <= aux:
		if aux % i == 0:
			if aux / i == i and i > b:
				x += 1
			else:
				if i > b:
					x += 1
				if aux / i > b:
					x += 1
		i += 1
	return x
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif b > a:
	print(0)
else:
	print(qtd_x(a, b))


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	(s, a) = (0, a - b)
	y = int(a ** 0.5)
	for x in range(1, y + 1):
		if a % x == 0:
			if x > b:
				s += 1
			if a > b * x:
				s += 1
	if y > b and y * y == a:
		s -= 1
	print(s)


import math
(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	x = a - b
	c = 0
	for i in range(1, int(math.sqrt(a)) + 1):
		if x % i == 0:
			if x // i == i:
				if i > b:
					c += 1
			else:
				if i > b:
					c += 1
				if x // i > b:
					c += 1
	print(c)


l1 = input().split()
l1 = [int(i) for i in l1]
x = l1[0]
y = l1[1]
if x == y:
	print('infinity')
else:
	x -= y
	mod = 0
	i = 1
	while i * i <= x:
		if x % i == 0:
			if i > y:
				mod += 1
			if x // i != i and x // i > y:
				mod += 1
		i += 1
	print(mod)


import math
(a, b) = map(int, input().split())
diff = a - b
if diff < 0:
	print(0)
elif diff == 0:
	print('infinity')
else:
	cnt = 0
	for i in range(1, 1 + int(math.sqrt(diff))):
		if diff % i == 0 and i > b:
			cnt += 1
		if diff % i == 0 and diff // i > b and (i * i != diff):
			cnt += 1
	print(cnt)


(a, b) = list(map(int, input().split()))
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:
	a -= b
	r = 0
	i = 1
	while i ** 2 <= a:
		if a % i != 0:
			i += 1
			continue
		if i > b:
			r += 1
		if i == a // i:
			i += 1
			continue
		if a // i > b:
			r += 1
		i += 1
	print(r)


def divisores(k, n):
	i = 1
	cont = 0
	while i <= n ** 0.5:
		if n % i == 0:
			if n / i == i and i > b:
				cont += 1
			else:
				if i > b:
					cont += 1
				if n / i > b:
					cont += 1
		i += 1
	return cont
(a, b) = [int(x) for x in input().split()]
x = a - b
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	print(divisores(b, x))


import math
(primeiro, segundo) = map(int, input().split())
diferenca = primeiro - segundo
saida = 0
if primeiro == segundo:
	print('infinity')
elif primeiro < segundo:
	print('0')
else:
	limite = int(math.sqrt(diferenca)) + 1
	for numero in range(1, limite):
		if diferenca % numero == 0:
			if numero * numero != diferenca:
				if diferenca / numero > segundo:
					saida += 1
				if numero > segundo:
					saida += 1
			elif numero > segundo:
				saida += 1
	print(saida)


import math

def main():
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a == b:
		print('infinity')
		return
	if b > a:
		print(0)
		return
	num = a - b
	div = []
	for i in range(1, int(math.sqrt(num)) + 1):
		if num % i == 0:
			div.append(i)
			div.append(num // i)
	div = list(set(div))
	div = sorted(div)
	p = 0
	while p < len(div) and div[p] <= b:
		p += 1
	div = div[p:]
	print(len(div))
	return
main()


(a, b) = map(int, input().split())
if a == b:
	print('infinity')
elif a < b:
	print(0)
else:
	res = set()
	n = a - b
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			if i > b:
				res.add(i)
			if n // i > b:
				res.add(n // i)
	print(len(res))


import math, time
(a, b) = [int(i) for i in input().split()]
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:

	def FindRequiredDivisors(x, b):
		y = 1
		ans = 0
		while y <= int(math.sqrt(x)):
			if x % y == 0:
				if y != int(x / y):
					if y > b:
						ans += 1
					if int(x / y) > b:
						ans += 1
				elif y == int(x / y) and y > b:
					ans += 1
			y += 1
		return ans
	print(FindRequiredDivisors(a - b, b))


(a, b) = list(map(int, input().split()))
if a < b:
	print(0)
elif a == b:
	print('infinity')
else:
	q = a - b
	i = 1
	r = 0
	while i * i < q:
		if q % i == 0:
			if i > b:
				r += 1
			if q // i > b:
				r += 1
		i += 1
	if i * i == q and i > b:
		r += 1
	print(r)


import math

def calculateDivisors(A, B):
	N = A - B
	noOfDivisors = 0
	a = math.sqrt(N)
	for i in range(1, int(a + 1)):
		if N % i == 0:
			if i > B:
				noOfDivisors += 1
			if N / i != i and N / i > B:
				noOfDivisors += 1
	return noOfDivisors

def numberOfPossibleWaysUtil(A, B):
	if A == B:
		return 'infinity'
	if A < B:
		return 0
	noOfDivisors = 0
	noOfDivisors = calculateDivisors(A, B)
	return noOfDivisors

def main_test():
	s = input().split(' ')
	if int(s[0]) + int(s[1]) + int(s[2]) >= 2:
		tt += 1
T = input().split(' ')
print(numberOfPossibleWaysUtil(int(T[0]), int(T[1])))


import math

def calculateDivisors(A, B):
	N = A - B
	noOfDivisors = 0
	a = math.sqrt(N)
	for i in range(1, int(a + 1)):
		if N % i == 0:
			if i > B:
				noOfDivisors += 1
			if N / i != i and N / i > B:
				noOfDivisors += 1
	return noOfDivisors

def possibiladesValidas(A, B):
	if A == B:
		return -1
	if A < B:
		return 0
	noOfDivisors = 0
	noOfDivisors = calculateDivisors(A, B)
	return noOfDivisors

def possibilidades(A, B):
	noOfSolutions = possibiladesValidas(A, B)
	if noOfSolutions == -1:
		print('infinity')
	else:
		print(noOfSolutions)
temp = input().split()
A = int(temp[0])
B = int(temp[1])
possibilidades(A, B)