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 <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/dd2b46f89067e3a9d9987c4263de702dd7518fa7.png" style="max-width: 100.0%;max-height: 100.0%;"/>. A Modular Equation, as Hamed's teacher described, is an equation of the form <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/fc4bae676fb9b7279f0b9e6781d3d2d6abf86586.png" style="max-width: 100.0%;max-height: 100.0%;"/> in which *a* and *b* are two non-negative integers and *x* is a variable. We call a positive integer *x* for which <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/fc4bae676fb9b7279f0b9e6781d3d2d6abf86586.png" style="max-width: 100.0%;max-height: 100.0%;"/> 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 <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/fc4bae676fb9b7279f0b9e6781d3d2d6abf86586.png" style="max-width: 100.0%;max-height: 100.0%;"/> has.
In the only line of the input two space-separated integers *a* and *b* (0 ≤ *a*, *b* ≤ 10<sup class="upper-index">9</sup>) are given.
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, div in enumerate(array_div):

        divisors = multiply_fact_n_times(divisors, div, array_div_population[div_idx])
    return divisors
'''

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


array_div = []
array_div_population = []
factor_count = 2
plus_two = False

first_module = n_to_mod - remainder
max_size = first_module // 2
count_modular_times = 0
module_controller = 2
if n_to_mod == remainder:
    print('infinity')
else:
    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)

	 	        	  		  		 		     			