import java.util.Scanner;

public class B {

    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        if (a == b) {
            System.out.println("infinity");
        } else {
            int count = 0;
            int k = a - b;
            for (int i = 1; i * i <= k; i++) {
                if (k % i == 0) {
                    if (i * i == k) {
                        if (i > b) {
                            count++;
                        }
                    } else {
                        if (i > b) count++;
                        if (k / i > b) count++;
                    }
                }
            }
            System.out.println(count);
        }
    }
}

/*
PROG: b
LANG: JAVA
*/
import java.util.*;
import java.io.*;

public class b {
  int bf(long a, long b) {
    int c = 0;
    for(long i = 1; i <= a; ++i) {
      if(a % i == b) ++c;
    }
    return c;
  }
  private void solve() throws Exception {
    //BufferedReader br = new BufferedReader(new FileReader("b.in"));
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] pa = br.readLine().split(" ");
    long a = Long.parseLong(pa[0]);
    long b = Long.parseLong(pa[1]);

    //a = 3;
    //b = 4;

    long n = a - b, r = 0;
    if(n == 0) {
      System.out.println("infinity");
    } else {
      for(long i = 1; i * i <= n; ++i) {
        long j = n / i;
        //debug(i, j, a % i, a % j);
        if(a % j == b) ++r;
        if(i != j && a % i == b) ++r;
      }
      //System.out.println(r + " " + bf(a, b));
      System.out.println(r);
    }

  }

  public static void main(String[] args) throws Exception {
    new b().solve();
  }

  static void debug(Object...o) {
    System.err.println(Arrays.deepToString(o));
  }

}

import java.util.Scanner;
public class Binarysearch {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
       long a = input.nextLong();
       long b = input.nextLong();
        long sum=0;
       if(a==b) System.out.println("infinity");

       else{
           if(a-b<b) System.out.println(0);
           else{
               long base = a-b;

                 for(long i = 1 ;i<=Math.sqrt(base);i++){
                   if(base%i==0){
                       if(i>b)sum++;
                       if(base/i > b && base/i!=i) sum++;
                   }
               }
               System.out.printf("%d\n",sum);
           }
       }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class B {

    public static void main(String[] args) throws IOException
    {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = sc.nextInt(), b = sc.nextInt();
        if(a == b)
            out.println("infinity");
        else
            if(a < b)
                out.println(0);
            else
            {
                int d = a - b;
                int sqrtD = (int)Math.sqrt(d);
                int ans = 0;
                for(int i = 1; i <= sqrtD; ++i)
                    if(d%i == 0)
                    {
                        if(a / i * i == d)
                            ++ans;
                        if(i != d / i)
                        {
                            int j = d / i;
                            if(a / j * j == a - b)
                                ++ans;
                        }
                    }
                out.println(ans);
            }
        out.flush();
        out.close();

    }

    static class Scanner
    {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException
        {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if(x.charAt(0) == '-')
            {
                neg = true;
                start++;
            }
            for(int i = start; i < x.length(); i++)
                if(x.charAt(i) == '.')
                {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                }
                else
                {
                    sb.append(x.charAt(i));
                    if(dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg?-1:1);
        }

        public boolean ready() throws IOException {return br.ready();}

    }
}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int A = in.nextInt();
		int B = in.nextInt();
		if (B > A) {
			System.out.println(0);
			return;
		} else if (B == A) {
			System.out.println("infinity");
		} else {
			int count = 0;
			for (int i = 1; i <= (int) Math.sqrt(A - B); i++) {
				if ((A - B) % i == 0) {
					if (i > B)
						count++;
					if ((A - B) / i > B)
						count++;
					if (i > B && i == (A - B) / i)
						count--;
				}
			}
				System.out.println(count);
		}
	}
}

import java.awt.List;
import java.io.*;
import java.util.*;

/*
 * kishan Thesiya
 * daiict
 * kishanthesiya25@gmail.com
 *
 *
 */

public class Main {
	FastScanner in;
	PrintWriter out;

	static ArrayList[] adj;
	static ArrayList[] obj;
	static int n;
	static int x;
	static int c;
	static int visited[];
	static int Ad[];
	static int Bd[];

	static int brr[][];
	static int a;
	static int b;
	static int parent[];
	static int size[];
	long mod = (long)1e9+7;
	static int ds[];

//Segment tree do not delete
	static int arr[];
	static int d[];
	static int h;
// till now

	class Segment{
	  private  int Lazy[];

	    void ans(){

	     int x = (int) (Math.ceil(Math.log(100000) / Math.log(2)));
	        int max_size = 2 * (int) Math.pow(2, x) - 1;
	        int SegTree[][] = new int[max_size][3]; // allocate memory
	        Lazy = new int[max_size];

	       String s = in.next();
	       n = s.length();

	        int q=in.nextInt();

	        build_ST(0, 0, n - 1,SegTree,s);

	        for(int i = 0;i<2*n;i++){
	        	System.out.println(SegTree[i][0] + " " + SegTree[i][1] + " " + SegTree[i][2] + " " + (i+n));
	        }

	        while(q-->0)
	        {
	          int a = in.nextInt();
	          int b = in.nextInt();

	          int d = getMaxST(0, n-1, a-1, b-1, 0,SegTree);
	          System.out.println(d);
	        }
	    }

	 void build_ST(int node, int start, int end,int SegTree[][],String s)
	   {
	    if(start > end) return;
	  	if(start == end) {
	  		System.out.println(start + " " + node);
	  		if(s.charAt(start) == '('){
	  			SegTree[node][1] = 1;
	  		}else{
	  			SegTree[node][2] = 1;
	  		}

			return;
		}
		int mid=(start + end) >> 1;
		build_ST(node*2+1, start, mid, SegTree,s); // Init left child
		build_ST(node*2+2, 1+mid, end,SegTree,s); // Init right child

		// Init root value

		int t = Math.min(SegTree[2*node + 1][1], SegTree[2*node+2][2]);

		SegTree[node][0] = SegTree[2*node+1][0] + SegTree[2*node+2][0] + 2*t;
		SegTree[node][1] = SegTree[2*node+1][1] + SegTree[2*node+2][1] - t;
		SegTree[node][2] = SegTree[2*node+1][2] + SegTree[2*node+2][2] - t;

	}
//	    void update_ST(int node, int start, int end, int l, int r, int diff) {
//	        if(Lazy[node] != 0)
//	        {
//	            int pending = Lazy[node];
//
//	            SegTree[node] -= pending;
//
//	           if(start != end)
//	            {
//	                Lazy[2 * node + 1] += Lazy[node];
//	                Lazy[2 * node + 2] += Lazy[node];
//	            }
//	           Lazy[node] = 0;
//	        }
//	        if (end < l || start > r)
//	            return ;
//	          if(l<=start && end<=r)
//	        {
//	        	  SegTree[node] -= diff;
//
//	            if(start != end) // not a leaf
//	            {
//	                Lazy[2*node+1] += diff;
//	                Lazy[2*node+2] += diff;
//	            }
//	            return;
//	        }
//	        int mid=(start + end) >> 1;
//		update_ST(node*2+1, start, mid, l, r, diff); // Updating left child
//		update_ST(2+node*2, 1+mid, end, l, r, diff); // Updating right child
//
//		SegTree[node] = Math.max(SegTree[node*2+1],SegTree[node*2+2]);
//
//	    }
	      int getMaxST(int start, int end, int l, int r, int node,int SegTree[][])
	    {
//	    	  if(Lazy[node] != 0)
//		        {
//		            int pending = Lazy[node];
//
//		            SegTree[node] -= pending;
//
//		           if(start != end)
//		            {
//		                Lazy[2 * node + 1] += Lazy[node];
//		                Lazy[2 * node + 2] += Lazy[node];
//		            }
//		           Lazy[node] = 0;
//		        }
	        if (l <= start && r >= end)
	            return SegTree[node][0];
	         if (end < l || start > r)
	            return 0;
	        int mid = (start + end) >> 1;
	        return getMaxST(start, mid, l, r, 2 * node + 1,SegTree)+getMaxST(mid + 1, end, l, r, 2 * node + 2,SegTree);
	    }

	}

	static class Pair implements Comparable<Pair>
    {
		int x;int y;

        Pair(int l, int m) {

        	this.x = l;
            this.y = m;

        }

        public int compareTo(Pair p) {
            if (this.x == p.x) {
                return (int)(this.y-p.y);
            }
            return (int)(this.x - p.x);
        }

        public String toString(){
        	return x + " " + y;
        }

        public boolean equals(Object o){
        	if(o instanceof Pair){
        		Pair a = (Pair)o;

        		return this.x == a.x && this.y == a.y;
        	}

        	return false;
        }

        public int hashCode(){
        	return new Long(x).hashCode()*31 + new Long(y).hashCode();
        }

    }

	public static int gcd(int a, int b) {
		if (b == 0) return a;
		return gcd(b, a%b);
	}

	public static int find(int i){
		if(parent[i] != i){
			return find(parent[i]);
		}

		return i;
	}

	public static void union(int a,int b){
		int ra = find(a);
		int rb = find(b);

		if(ra!= rb){
			if(size[ra] > size[rb]){
				parent[rb] =ra;
				size[ra] += size[rb];
			}else{
				parent[ra] = rb;
				size[rb] += size[ra];
			}
		}

	}

	public static void apply(int p,int value){
		arr[p] += value;

		if(p < n){
			d[p] += value;
		}
	}

	public static void push(int p){

		for(int s = h;s>0;s--){
			int i = p >> s;

			if(d[i] != 0){
				apply(i<<1,d[i]);
				apply(i<<1|1,d[i]);
				d[i] = 0;
			}
		}
	}

	public static void lazybuild(int p){
		while(p > 1){
			p>>=1;
			arr[p] = Math.max(arr[p<<1], arr[p<<1|1]) + d[p];
		}
	}

	public static void lazyupdate(int l,int r,int value){
		l += n; r += n+1;
		int l0 = l;int r0 = r;
		for(;l<r; l>>=1,r>>=1){
			if((l&1) == 1){
				apply(l++,value);
			}

			if((r&1) == 1){
				apply(--r,value);
			}
		}
		lazybuild(l0);
		lazybuild(r0-1);

	}

	public static int lazyquery(int l,int r){
		l += n;r += n+1;
		push(l);push(r-1);
		int res = (int)-2e9;

		for(;l<r;l>>=1,r>>=1){
			if((l&1) == 1){
				res = Math.max(arr[l++], res);
			}

			if((r&1) == 1){
				res = Math.max(arr[--r], res);
			}
		}

		return res;
	}

	public static void build(){

		for(int i = n-1;i>0;i--){
			arr[i] = Math.max(arr[i<<1], arr[i<<1|1]);
		}

	}

	public static void update(int p,int v){

		for(arr[p += n] = v; p>0; p>>=1 ){
			arr[p>>1] = Math.max(arr[p], arr[p^1]);
		}

	}

	public static int query(int l,int r){

		r++;
		int max = 0;
		for(l +=n,r +=n;l<r; l>>=1,r>>=1 ){

			if((l&1) == 1){
				max = Math.max(max, arr[l++]);
			}

			if((r&1) == 1){
				max = Math.max(max, arr[--r]);
			}
		}

		return max;
	}

	void multiply(long a[][], long b[][])
	{

	    long mul[][] = new long[3][3];
	    for (int i = 0; i < 3; i++)
	    {
	        for (int j = 0; j < 3; j++)
	        {
	            mul[i][j] = 0;
	            for (int k = 0; k < 3; k++)
	                mul[i][j] = (int) ((mul[i][j] + (a[i][k]*b[k][j])%mod)%mod);
	        }
	    }

	    for (int i=0; i<3; i++)
	        for (int j=0; j<3; j++)
	            a[i][j] = mul[i][j];
	}

	long power(long F[][], long n)
	{
	    long M[][] = {{1,1,0}, {1,0,0}, {0,1,0}};

	    if (n==1)
	        return (long) ((F[0][0] + F[0][1])%mod);

	    power(F, n/2);

	    multiply(F, F);

	    if (n%2 != 0)
	        multiply(F, M);

	    return (long) ((F[0][0] + F[0][1])%mod) ;
	}

	long findNthTerm(long n)
	{
	    long[][] F = {{1,1,0}, {1,0,0}, {0,1,0}} ;

	    return power(F, n);
	}

    void solve() throws NumberFormatException, IOException {

    	Scanner in = new Scanner (System.in);

    	int n = in.nextInt();
    	int m = in.nextInt();
    	int c = n-m;

    	int ans = 0;
    	if(m >n){
    		System.out.println(0);
    	}else if(n == 1 && m == 0){
    		System.out.println(1);
    	}else if(c == 0){
    		System.out.println("infinity");
    	}else if(c>0){

    		for(int i = 1;i*i<=c;i++){
//    			System.out.println(i + " " + c/i);
    			int d = -1;
    			if(c%i == 0 && i > m){
    				ans++;
    				d = i;
    				//System.out.println(i);
    			}

    			if(c/i != d && c%(c/i) == 0 && c/i > m){
    				ans++;
    				//System.out.println(c/i);
    			}
    		}

    		System.out.println(ans);
    	}

    	//System.out.println(ans);
//    	Segment s = new Segment();
//
//    	s.ans();

//    	n = in.nextInt();
//    	arr = new int[2*n];
//    	d = new int[n];
//    	h = (int)Math.ceil((Math.log(n)/Math.log(2)));
//    	for(int i = 0;i<n;i++){
//    		arr[i+n] = in.nextInt();
//    	}
//
//    	build();

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

//    	 StringBuilder sb = new StringBuilder();
//
//    	 int tests = Integer.parseInt(br.readLine().trim());
//
//          while (tests-- > 0) {
//
//
//          }
//
//
//          System.out.println(sb.toString());
//

}

    public static String[] reverse(String arr[]){

    	for(int i = 0;i<arr.length/2;i++){
    		String temp = arr[i];
    		arr[i] = arr[arr.length-i-1];
    		arr[arr.length-1-i] = temp;
    	}

    	return arr;

    }

    private static long ans(long n){
        if(n==1) return 2;
        n+=1;
        int cnt=-1;
        while(n%2==0){
            n/=2;
            cnt++;
        }
        if(n==1){
            return (int)Math.pow(2,cnt)-1;
        }
        return -1;
    }
    public static long sum(long x){
    	return x<10?x:x%10 + sum(x/10);
    }

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd( y % x,x);
	}
	public static long pow(long n,long p,long m){
        long  result = 1;
         if(p==0)
           return 1;
       if (p==1)
           return n;
       while(p!=0)
       {
           if(p%2==1)
               result *= n;
           if(result>=m)
           result%=m;
           p >>=1;
           n*=n;
           if(n>=m)
           n%=m;
       }
       return result;
       }

	public static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}

	void run() throws NumberFormatException, IOException {
		in = new FastScanner();
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	class Tri{

		Tri[] arr;

		public Tri(){
			arr = new Tri[27];
		}

	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		new Main().run();
	}
}

class Node{
	int a;
	int b;
	int c;
}

class MyComp implements Comparator<Node>{

	@Override
	public int compare(Node a,Node b) {

		// < == -1

		if(a.a < b.a){
			return -1;
		}else if(a.a > b.a){
			return 1;
		}else{
			return 0;
		}

	}
}

import java.util.Scanner;

public class Amazon {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNextInt()) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			if (a == b) {
				System.out.println("infinity");
				continue;
			}

			if (a < b) {
				System.out.println(0);
				continue;
			}

			int c = a - b;
			int answer = 0;

			double fin = Math.sqrt(a);
			for (int i = 1; i <= fin; i++) {
				if (c % i == 0) {
					int d = c / i;

					if (i > b) {
						answer++;
					}

					if (i != d && d > b) {
						answer++;
					}
				}
			}

			System.out.println(answer);
		}
	}
}

import java.util.Scanner;

public class ModularEquations{
  public static void main( String args[] ){
    int a;
    int b;
    int c;
    int x[];
    int count;
    count = 0;

    Scanner scan = new Scanner( System.in );

    a = scan.nextInt();
    b = scan.nextInt();

    if( a == b ){
      System.out.println( "infinity" );
    }
    else if ( a < b ){
      System.out.println( 0 );
    }
    else{
      c = a - b;
      for( int num = 1 ; num <= Math.sqrt(c) ; num++ ){
        if( c % num == 0 ){
          if( num > b ){
            count++;
          }
          if( c/num > b ){
            if( c/num != num ){
              count++;
            }
          }
        }
      }
      System.out.println( count );
    }
  }
}

import java.util.Scanner;

public class Main{
    public static void main(String[] args){

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int count = 0;
        int y = a -b;

        if(y==0){
            System.out.println("infinity");

        return;
        }

        for (int i = 1; i*i <= y; i++){
              if (y % i == 0) {
                   if (i > b)
                        count++;
                   if (y/i > b && i*i!= y)
                      count++;
                }
            }

        System.out.println(count);
        in.close();
    }

}

import java.io.*;
import java.util.*;
public class b282{
	public static int[] factor(int n)
	{
		int ar[]=new int[((int)Math.sqrt(n)+1)*2+1];
		Arrays.fill(ar,-1);
		int x=0;
		for(int i=1;i<(int)Math.sqrt(n)+1;i++) {
			if(n%i==0)
			{
				ar[x++]=i;
				if(i!=n/i)
				 ar[x++]=n/i;
			}
		}
		return ar;
	}
   public static void main(String[] args) {
      MyScanner obj = new MyScanner();
      int a=obj.nextInt();
      int b=obj.nextInt();
      if(a==b)
      System.out.println("infinity");
      else if(a-b<0)
      System.out.println(0);
      else
      {
		  int cnt=0;
		  int arr[]=factor(a-b);
		  for(int i=0;i<arr.length;i++)
		  {
			  if(arr[i]>b)
			  cnt+=1;
		  }
		  System.out.println(cnt);
	  }
}

   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }
}

import java.io.*;
import java.util.*;

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine(), " :");
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    public static void main(String[] args) {
        new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    void solve() throws IOException {
        int a = readInt();
        int b = readInt();
        if (a == b) {
            out.println("infinity");
            return;
        }
        if (b > a) {
            out.println(0);
            return;
        }
        int d = a - b;
        HashSet<Integer> set = new HashSet<>();
        for (int i = 1; i * i <= d; i++) {
            if (d % i == 0) {
                if (i > b) set.add(i);
                if (d / i > b) set.add(d / i);
            }
        }
        out.println(set.size());

    }

}

import java.util.*;
public class b
{
	public static void main(String[] arg)
	{
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		if(b > a)
			System.out.println(0);
		else if(a == b)
			System.out.println("infinity");
		else
		{
			int num = a-b;
			int answer = 0;
			int stop = (int)Math.sqrt(num);
			for(int i = 1; i <= stop; i++)
			{
				if(num % i == 0 && i > b)
					answer++;
				if(num % (num/i) == 0 && (num/i) > b && i != (num/i))
					answer++;
			}
			System.out.println(answer);

		}

	}

}

import java.util.ArrayList;
import java.util.Scanner;

public class b {
	public static void main(String[] args) {
		Scanner input = new Scanner (System.in);

		int a, b;
		a= input.nextInt();
		b = input.nextInt();
		if(b > a){
			System.out.println("0");
			return;
		}else if (b == a)
			System.out.println("infinity");
		else{
			int dif = a-b;
			ArrayList <Long> possible = new ArrayList<>();
			for(int i = 1; i <= Math.sqrt(dif); i++){
				if(dif%i == 0){
					int val1 = dif/i;
					int val2 = dif/val1;
					if(val1 > b)
						possible.add(Long.parseLong(i+""));
					if ( val1 != val2 && val2 > b)
						possible.add(Long.parseLong(i+""));
				}
			}
			System.out.println(possible.size());
		/*	for(Long i : possible){
				System.out.print(i +" " );

			}System.out.println();*/
		}

	}
}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author minhthai
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    int A, B;
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        A = in.nextInt(); B = in.nextInt();
        int C = A - B;
        if(C == 0) {
            out.println("infinity");
            return;
        }
        int count = 0, limit = (int)Math.sqrt(C), c2 = 0, near = -1;
        for(int i = 1; i <= limit; ++i) {
            if(i == near)
                break;
            if(C % i == 0 && C / i > B) {
                int quo = C / i;
                count += 1; //out.print("" + i + " ");
                if(i > B && quo != i) c2++;
                near = quo;
            }
        }

        out.println(count + c2);
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.Scanner;

public class modeqs {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long a = in.nextLong();
		long b = in.nextLong();

		if (a < b)
			System.out.println(0);
		else if (a == b)
			System.out.println("infinity");
		else {
			long count = 0;
			long init = a - b;
			for (long i = 1; i * i <= init; i++) {
				if (init % i == 0) {
					if (i > b)
						count++;
					long div = init / i;
					if (div != i && div > b)
						count++;
				}
			}
			System.out.println(count);
		}
		in.close();
	}

}

import java.io.*;
import java.util.*;

public class CF495B {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int a = Integer.parseInt(st.nextToken());
		int b = Integer.parseInt(st.nextToken());
		if (a == b) {
			System.out.println("infinity");
			return;
		}
		int d = a - b;
		int cnt = 0;
		for (int p = 1; p * p <= d; p++)
			if (d % p == 0) {
				if (p > b)
					cnt++;
				int q = d / p;
				if (q != p && q > b)
					cnt++;
			}
		System.out.println(cnt);
	}
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public final class CF_Modular {

	void log(int[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}

	void log(long[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}
	void log(Object[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}

	void log(Object o){
		logWln(o+"\n");
	}

	void logWln(Object o){
		//System.out.print(o);
		outputWln(o);

	}
	void info(Object o){
		System.out.println(o);
		//output(o);
	}

	void output(Object o){

		outputWln(""+o+"\n");

	}

	void outputWln(Object o){
		// System.out.print(o);

		try {
			out.write(""+ o);
		} catch (Exception e) {

		}
	}

	String next(){
		while (st== null|| !st.hasMoreTokens()) {
			try {
				st=new StringTokenizer(in.readLine());
			} catch (Exception e) {
			}
		}
		return st.nextToken();
	}

	String nextLine(){
		try {
			return in.readLine();
		} catch (Exception e) {
		}
		return null;
	}

	int nextInt(){
		return Integer.parseInt(next());
	}

	long nextLong(){
		return Long.parseLong(next());

	}

	// Global vars
	StringTokenizer st;
	BufferedReader in;
	BufferedWriter out;

	void solve(int a,int b){

		ArrayList<Integer> divisors=new ArrayList<Integer>();
		ArrayList<Integer> coef=new ArrayList<Integer>();
		if (b>a){
			output("0");
			return;
		}
		if (a==b) {
			output("infinity");
			return;
		}

		int delta=a-b;
		if (delta<=b) {
			output("0");
			return;
		}
		int cnt=0;
		for (int i=1;i*i<=delta;i++){
			//log("delta:"+delta);
			//log("i:"+i+" delta%i"+(delta%i));
			if (delta % i==0){

				if (i>b) {
					cnt++;
					//log(i);
				}
				if (delta/i>b && delta/i!=i){
				//	log(delta/i);
					cnt++;
				}
			}
		}
		output(cnt);
	}

	void process() throws Exception {

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		in=new BufferedReader(new InputStreamReader(System.in));

		int a=nextInt();
		int b=nextInt();
		solve(a,b);

		try {
			out.close();
		}
		catch (Exception e){}

	}

	public static void main(String[] args) throws Exception {
		CF_Modular J=new CF_Modular();

		J.process();

	}

}

import java.io.*;
import java.util.*;
import java.math.*;

public class Solution {

	public static void main(String[] args) throws IOException {
 		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out=new PrintWriter(System.out);
//		int n=Integer.parseInt(reader.readLine());
		StringTokenizer str=new StringTokenizer(reader.readLine());
		int a=Integer.parseInt(str.nextToken()), b=Integer.parseInt(str.nextToken());
//		int[] arr=new int[n];
//		for(int i=0;i<n;i++) arr[i]=Integer.parseInt(str.nextToken());
		if(a<b){
			out.println("0");
		}
		else if(a==b){
			out.println("infinity");
		}
		else{
			int n=a-b;
			int max=(int) Math.sqrt(n);
			long count=0;
			for(int i=1;i<=max;i++)
			{
				if(n%i==0){
					if(i*i==n && i>b){
						count++;
					}
					else{
						if(i>b){
							count++;
						}
						if(n/i>b){
							count++;
						}
					}
				}
			}
			out.println(count);
		}
		out.close();
		reader.close();
	}
}

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Main {
    private static Scanner sc;
    private static Printer pr;
    static boolean []visited;
    static int []color;
    static int []pow=new int[(int)3e5+1];
    static int []count;
    static boolean check=true;
    static boolean checkBip=true;
    static ArrayList<Integer>[]list;
    private static long aLong=(long)(Math.pow(10,9)+7);
    static final long div=998244353;
    static  int answer=0;
    static int[]countSubTree;
    static ArrayList<pairTask>task=new ArrayList<>();
    private static void solve() throws IOException {
        long a=sc.nextLong(),b=sc.nextLong();
        TreeSet<Long>list=new TreeSet<>();
        if (a==b){
            System.out.println("infinity");
            System.exit(0);
        }else{
            if (a<b){
                System.out.println(0);
                System.exit(0);
            }
            long rem=a-b;
            for (long i=1;i*i<=rem;i++){
                if (rem%i==0){
                    list.add(rem/i);
                    list.add(i);
                }
            }
        }
        TreeSet<Long>set=new TreeSet<>();
        if (list.floor(b)==null){
            System.out.println(list.size());
            System.exit(0);
        }else {
            long num=list.floor(b);
            set.addAll(list.subSet(num + 1, list.last() + 1));
            //System.out.println("set:"+set);
            System.out.println(set.size());
        }
    }
    public static class pairTask{
        int  x,y;
        public pairTask(int  x, int  y) {
            this.x = x;
            this.y = y;
        }
    }
    public static void subTree(int src,int parent){
        countSubTree[src]=1;
        for (int v:list[src]){
            if (v==parent)
                continue;
            subTree(v,src);
            countSubTree[src]+=countSubTree[v];
        }
    }
    public static boolean prime(int src){
        for (int i=2;i*i<=src;i++){
            if (src%i==0)
                return false;
        }
        return true;
    }
    public static void bfsColor(int src){
        Queue<Integer>queue = new ArrayDeque<>();
        queue.add(src);
        while (!queue.isEmpty()){
            boolean b=false;
            int vertex=-1,p=-1;
            int poll=queue.remove();
            for (int v:list[poll]){
                if (color [v]==0){
                    vertex=v;
                    break;
                }
            }
            for (int v:list[poll]){
                if (color [v]!=0&&v!=vertex){
                    p=v;
                    break;
                }
            }
            for (int v:list[p]){
                if (color [v]!=0){
                    color[vertex]=color[v];
                    b=true;
                    break;
                }
            }
            if (!b){
                color[vertex]=color[poll]+1;
            }
        }
    }
    static int add(int a,int b ){
        if (a+b>=div)
            return (int)(a+b-div);
        return (int)a+b;
    }
    public static int isBipartite(ArrayList<Integer>[]list,int src){
        color[src]=0;
        Queue<Integer>queue=new LinkedList<>();
        int []ans={0,0};
        queue.add(src);
        while (!queue.isEmpty()){
            ans[color[src=queue.poll()]]++;
            for (int v:list[src]){
                if (color[v]==-1){
                    queue.add(v);
                    color[v]=color[src]^1;
                }else if (color[v]==color[src])
                    check=false;
            }
        }
        return add(pow[ans[0]],pow[ans[1]]);
    }
    public static int powerMod(long b, long e){
        long ans=1;
        while (e-->0){
            ans=ans*b%div;
        }
        return (int)ans;
    }
    public static int dfs(int s){
        int ans=1;
        visited[s]=true;
        for (int k:list[s]){
            if (!visited[k]){
                ans+=dfs(k);
            }
        }
        return ans;
    }
    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }
    public static long []primeFactor(int n){
        long []prime=new long[n+1];
        prime[1]=1;
        for (int i=2;i<=n;i++)
            prime[i]=((i&1)==0)?2:i;
        for (int i=3;i*i<=n;i++){
            if (prime[i]==i){
                for (int j=i*i;j<=n;j+=i){
                    if (prime[j]==j)
                        prime[j]=i;
                }
            }
        }
        return prime;
    }
    public static StringBuilder binaryradix(long number){
        StringBuilder builder=new StringBuilder();
        long remainder;
        while (number!=0) {
            remainder = number % 2;
            number >>= 1;
            builder.append(remainder);
        }
        builder.reverse();
        return builder;
    }
    public static int binarySearch(long[] a, int index,long target) {
            int l = index;
            int h = a.length - 1;
            while (l<=h) {
                int med = l + (h-l)/2;
                if(a[med] - target <= target) {
                    l = med + 1;
                }
                else h = med  - 1;
            }
            return h;
    }
    public static int val(char c){
        return c-'0';
    }
    public static long gcd(long a,long b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }
        private static class Pair implements Comparable<Pair> {
            long x;
            long y;

            Pair() {
                this.x = 0;
                this.y = 0;
            }

            Pair(long x, long y) {
                this.x = x;
                this.y = y;
            }

            @Override
            public boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                if (obj == null) return false;
                Pair other = (Pair) obj;
                if (this.x == other.x && this.y == other.y) {
                    return true;
                }
                return false;
            }

            @Override
            public int compareTo(Pair other) {
                if (this.x != other.x) return Long.compare(this.x, other.x);
                return Long.compare(this.y*other.x, this.x*other.y);
            }
    }

    public static void main(String[] args) throws IOException {
        sc = new Scanner(System.in);
        pr = new Printer(System.out);
        solve();

        pr.close();
       // sc.close();
    }
    private static class Scanner {
        BufferedReader br;

        Scanner (InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        private boolean isPrintable(int ch) {
            return ch >= '!' && ch <= '~';
        }

        private boolean isCRLF(int ch) {
            return ch == '\n' || ch == '\r' || ch == -1;
        }

        private int nextPrintable() {
            try {
                int ch;
                while (!isPrintable(ch = br.read())) {
                    if (ch == -1) {
                        throw new NoSuchElementException();
                    }
                }

                return ch;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        String next() {
            try {
                int ch = nextPrintable();
                StringBuilder sb = new StringBuilder();
                do {
                    sb.appendCodePoint(ch);
                } while (isPrintable(ch = br.read()));

                return sb.toString();
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        int nextInt() {
            try {
                // parseInt from Integer.parseInt()
                boolean negative = false;
                int res = 0;
                int limit = -Integer.MAX_VALUE;
                int radix = 10;

                int fc = nextPrintable();
                if (fc < '0') {
                    if (fc == '-') {
                        negative = true;
                        limit = Integer.MIN_VALUE;
                    } else if (fc != '+') {
                        throw new NumberFormatException();
                    }
                    fc = br.read();
                }
                int multmin = limit / radix;

                int ch = fc;
                do {
                    int digit = ch - '0';
                    if (digit < 0 || digit >= radix) {
                        throw new NumberFormatException();
                    }
                    if (res < multmin) {
                        throw new NumberFormatException();
                    }
                    res *= radix;
                    if (res < limit + digit) {
                        throw new NumberFormatException();
                    }
                    res -= digit;

                } while (isPrintable(ch = br.read()));

                return negative ? res : -res;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        long nextLong() {
            try {
                // parseLong from Long.parseLong()
                boolean negative = false;
                long res = 0;
                long limit = -Long.MAX_VALUE;
                int radix = 10;

                int fc = nextPrintable();
                if (fc < '0') {
                    if (fc == '-') {
                        negative = true;
                        limit = Long.MIN_VALUE;
                    } else if (fc != '+') {
                        throw new NumberFormatException();
                    }
                    fc = br.read();
                }
                long multmin = limit / radix;

                int ch = fc;
                do {
                    int digit = ch - '0';
                    if (digit < 0 || digit >= radix) {
                        throw new NumberFormatException();
                    }
                    if (res < multmin) {
                        throw new NumberFormatException();
                    }
                    res *= radix;
                    if (res < limit + digit) {
                        throw new NumberFormatException();
                    }
                    res -= digit;

                } while (isPrintable(ch = br.read()));

                return negative ? res : -res;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        float nextFloat() {
            return Float.parseFloat(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                int ch;
                while (isCRLF(ch = br.read())) {
                    if (ch == -1) {
                        throw new NoSuchElementException();
                    }
                }
                StringBuilder sb = new StringBuilder();
                do {
                    sb.appendCodePoint(ch);
                } while (!isCRLF(ch = br.read()));

                return sb.toString();
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        void close() {
            try {
                br.close();
            } catch (IOException e) {
//				throw new NoSuchElementException();
            }
        }
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class List {
        String Word;
        int length;

        List(String Word, int length) {
            this.Word = Word;
            this.length = length;
        }
    }
    private static class Printer extends PrintWriter {
        Printer(PrintStream out) {
            super(out);
        }
    }
}

import java.util.Scanner;

public class ModularEquation {

    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int N = a - b;
        if(N == 0)
        {
            System.out.println("infinity");
            return;
        }
        else if (N < 0)
            System.out.println("0");
        else
        {
            int count = 0;
            for (int i = 1; i*i <= N; i++) {
                if(N%i == 0 && i > b) count++;
                if(N % (N/i) == 0 && (N/i)>b) count++;
            }

            if(Math.sqrt(N) * Math.sqrt(N) == N && N % Math.sqrt(N) == 0 && Math.sqrt(N) > b)
                count--;
            System.out.println(count);
        }
    }
}

import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long ost = a - b;
        long n = 0;
        if (a < b && a != 0) {
            System.out.println("0");
            return;
        }
        if (a == b) {
            System.out.println("infinity");
            return;
        }
        if (a < b && a == 0) {
            System.out.println("0");
            return;
        }
        for (long i = 1; i <Math.sqrt(ost); i++) {
            if (ost % i == 0) {
            if (ost/i > b) n++;
            if (i > b) n++;
}}
if (ost%Math.sqrt(ost)==0 && ost/Math.sqrt(ost)>b) n++;

        System.out.println(n);
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            if (a < b) {
                out.println(0);
            } else if (a == b) {
                out.println("infinity");
            } else {
                int count = 0;
                int i;
                int n = a - b;
                int start = b;
                for (i = 1; i * i < n; i++)
                    if (n % i == 0) {
                        if (i > start) count++;
                        if (n / i > start) count++;
                    }
                if (i * i == n && i > start) count++;
                out.println(count);
            }
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.Scanner;

public class AliceFriend
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();

        int nr = 0;

        if (a < b) System.out.println(0); else
            if (a == b) System.out.println("infinity"); else
            {
                int l = a - b;
                int answer = 0;

                for (int i = 1; i * i <= l; i++)
                    if (l % i == 0) {

                        int x = l / i;

                        if (l % x == 0 && l / x > b) answer++;
                        if (x * x != l && l % i == 0 && l / i > b) answer++;

                    }

                System.out.println(answer);
            }

    }
}

import java.util.*;
public class ModularEquations
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();

		if(a == b)
		{
			System.out.println("infinity");
		}
		else if(a < b)
		{
			System.out.println(0);
		}
		else
		{
			long d = a - b;

			long x = 1;
			int result = 0;
			while(x * x <= d)
			{
				if(d % x == 0)
				{
					if(x > b)
					{
						result++;
					}

					if(d / x != x && d / x > b)
					{
						result++;
					}
				}

				x++;
			}

			System.out.println(result);
		}
	}
}

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int count = 0;
        if(a==b)
            System.out.println("infinity");
        else if(a>b){
            for (int i = 1; i <= Math.sqrt(a-b); i++) {
                if((a-b)%i==0 && i!=(a-b)/i){
                    if(a%i==b)
                        count++;
                    if(a%((a-b)/i)==b)
                        count++;
                }
                else if((a-b)%i==0)
                    if(a%i==b)
                        count++;
            }
            System.out.println(count);
        }
        else{
            System.out.println("0");
        }
    }
}

import java.io.DataInputStream;
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){

		InputReader scan = new InputReader();
		int a = scan.nextInt(), b = scan.nextInt(), diff = a - b, count = 0;
		for(int i = 1; i <= Math.sqrt(diff); i++){
			if(diff % i != 0) continue;
			if(i > b) count++;
			if(diff / i > b && diff / i != i) count++;
		}
		if(diff == 0) System.out.println("infinity");
		else System.out.println(count);
	}

	// Custom Scanner

	interface Input {
		public String next();
		public String nextLine();
		public int nextInt();
		public long nextLong();
		public double nextDouble();
	}

	static class InputReader implements Input {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public InputReader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try {
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch (IOException e) {
				throw new RuntimeException();
			}
		}
		public String next() {
			int c;
			while ((c = read()) != -1 && (c == ' ' || c == '\n' || c == '\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1) {
				if (c == ' ' || c == '\n' || c == '\r')
					break;
				s.append((char) c);
				c = read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while ((c = read()) != -1 && (c == ' ' || c == '\n' || c == '\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1) {
				if (c == '\n' || c == '\r')
					break;
				s.append((char) c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}
			if (neg)
				return -ret;
			return ret;
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author Siryy Sergiy
 *         created in 13.12.2014
 */
public class prb {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        String s = in.readLine();

        int first = Integer.parseInt(s.split(" ")[0]);
        int second = Integer.parseInt(s.split(" ")[1]);

        if (second > first) System.out.println(0);
        else if (first == second) System.out.println("infinity");
        else {
            first -= second;
            int k = 0;
            double f = Math.sqrt(first);
            for(int i = 1; i <=f; i++)
                if (first % i == 0) {
                    if (i > second) k++;
                    if (i != first/ i)
                    if (first / i > second) k++;
                }
            System.out.println(k);
        }

    }
}

import java.util.*;

public class ModularEquations {

    public static void solve(int a, int b) {
        if(a == b) {
            System.out.println("infinity");
        }
        else if(a < b) {
            System.out.println(0);
        }
        else {
            int res = 0;
            int residual = a - b;
            int factor = (int)Math.floor(Math.sqrt(a-b));
            for(int i = 1; i <= factor; i++) {
                if(residual % i == 0) {
                    int j = residual / i;
                    if(i == j) {
                        if(i > b)
                            res += 1;
                    }
                    else {
                        if(i > b && j > b)
                            res += 2;
                        else if(i > b || j > b)
                            res += 1;
                    }
                }
            }
            System.out.println(res);
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            solve(a, b);
        }
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;

public class Trial{
	static int a,b;

	static public int divisors(){
		int x=a-b,counter=0;
		for(int i=1;i<=x/i;i++){
			if(x%i==0 ){
				if(a%i==b){
					counter++;
				}
				if(a%(x/i)==b && i!=a/i){
					counter++;
				}
			}
		}
		return counter;
	}

	static public void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] in = br.readLine().split(" ");
		a=Integer.parseInt(in[0]);
		b=Integer.parseInt(in[1]);
		if(a==b)
			System.out.println("infinity");
		else{
			System.out.println(divisors());
		}
	}
}

import java.io.*;
import java.util.*;

public class B {
    void solve() throws IOException {
        long a = nextLong(), b = nextLong();

        if (a != b) {
            long counter = 0;

            if (a > b) {
                long c = a - b;
                long l = 1, u = c / l;
                while (l <= u) {
                    if (c % l == 0) {
                        if (l > b) {
                            counter++;
                        }
                        if (c / l != l && c / l > b) {
                            counter++;
                        }
                    }

                    l++;
                    u = c / l;
                }
            }

            out.println(counter);
        } else {
            out.println("infinity");
        }
    }

    void run() throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        // reader = new BufferedReader(new FileReader("file.in"));
        // out = new PrintWriter(new FileWriter("file.out"));
        tokenizer = null;
        solve();
        reader.close();
        out.flush();
    }

    public static void main(String[] args) throws IOException {
        new B().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class MainB {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	final int MOD = 1000000007;
	final int M = 1000000000;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a == b) {
			System.out.println("infinity");
			return;
		}
		if (a < b) {
			System.out.println(0);
			return;
		}
		int cnt = 0;
		int sub = a - b;
		HashSet<Integer> hs = new HashSet<Integer>();
		for(int i=1;i*i<=M;i++) {
			if(sub % i ==0) {
				hs.add(i);
				hs.add(sub/i);
			}
		}
		for(int div: hs) {
			if(a % div == b) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}

	public static void main(String[] args) {
		new MainB().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	boolean inner(int h, int w, int limH, int limW) {
		return 0 <= h && h < limH && 0 <= w && w < limW;
	}

	void swap(int[] x, int a, int b) {
		int tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

	// find minimum i (a[i] >= border)
	int lower_bound(int a[], int border) {
		int l = -1;
		int r = a.length;

		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (border <= a[mid]) {
				r = mid;
			} else {
				l = mid;
			}
		}
		// r = l + 1
		return r;
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}

		int[] nextIntArray(int n) {
			int[] in = new int[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextInt();
			}
			return in;
		}

		int[][] nextInt2dArray(int n, int m) {
			int[][] in = new int[n][m];
			for (int i = 0; i < n; i++) {
				in[i] = nextIntArray(m);
			}
			return in;
		}

		double[] nextDoubleArray(int n) {
			double[] in = new double[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextDouble();
			}
			return in;
		}

		long[] nextLongArray(int n) {
			long[] in = new long[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextLong();
			}
			return in;
		}
	}
}

import java.util.*;
public class bb {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int a = input.nextInt(), b = input.nextInt();
    if(a == b) System.out.println("infinity");
    else if(a < b) System.out.println(0);
    else
    {
        int res = 0;
        int diff = a - b;
        for(int i = 1; i<= Math.sqrt(diff); i++)
        {
            if(diff%i != 0) continue;
            if(b < i) res++;
            if(i*i != diff && diff/i > b) res++;
        }
        System.out.println(res);
    }
}
}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.lang.*;

public class TaskB implements Runnable {
    boolean prime[] = new boolean[100001];
    void sieveOfEratosthenes(int n) {
        for (int i = 0; i < n; i++)
            prime[i] = true;
        for (int p = 2; p * p <= n; p++) {
            if (prime[p] == true) {
                for (int i = p * p; i <= n; i += p)
                    prime[i] = false;
            }
        }
    }
    public void run() {
        InputReader c = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n=c.nextInt();
        int m=c.nextInt();
        if(m==n){
            System.out.println("infinity");
            return;
        }
        int ht=n-m;
        if(ht<0) {
            System.out.println(0);
            return;
        }
        int cnt=0;
        for(int i=1;i<=(int)Math.sqrt(ht);i++){
            if(ht%i==0) {
                if (i*i == ht) {
                    if (n % i == m)
                        cnt++;
                    else if (n % (ht / i) == m)
                        cnt++;
                    continue;
                }
            }
            if(ht%i==0){
                if(n%i==m)
                    cnt++;
                if(n%(ht/i)==m)
                    cnt++;
            }
        }
        System.out.println(cnt);
        w.close();
    }
    class pair{
        int x,c;
        public pair(int a,int b){
            x=a;c=b;
        }
    }
    public static void sortbyColumn(int arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<int[]>()
        {
            public int compare(int[] o1, int[] o2){
                return(Integer.valueOf(o1[col]).compareTo(o2[col]));
            }
        });

    }
    class Graph{
        private final int v;
        private List<List<Integer>> adj;
        Graph(int v){
            this.v = v;
            adj = new ArrayList<>(v);
            for(int i=0;i<v;i++){
                adj.add(new LinkedList<>());
            }
        }
        private void addEdge(int a,int b){
            adj.get(a).add(b);
        }
        private boolean isCyclic()
        {
            boolean[] visited = new boolean[v];
            boolean[] recStack = new boolean[v];
            for (int i = 0; i < v; i++)
                if (isCyclicUtil(i, visited, recStack))
                    return true;

            return false;
        }
        private boolean isCyclicUtil(int i, boolean[] visited, boolean[] recStack)
        {
            if (recStack[i])
                return true;
            if (visited[i])
                return false;
            visited[i] = true;
            recStack[i] = true;
            List<Integer> children = adj.get(i);
            for (Integer c: children)
                if (isCyclicUtil(c, visited, recStack))
                    return true;
            recStack[i] = false;
            return false;
        }
    }
    static long gcd(long a, long b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    public static class DJSet {
        public int[] upper;

        public DJSet(int n) {
            upper = new int[n];
            Arrays.fill(upper, -1);
        }

        public int root(int x) {
            return upper[x] < 0 ? x : (upper[x] = root(upper[x]));
        }

        public boolean equiv(int x, int y) {
            return root(x) == root(y);
        }

        public boolean union(int x, int y) {
            x = root(x);
            y = root(y);
            if (x != y) {
                if (upper[y] < upper[x]) {
                    int d = x;
                    x = y;
                    y = d;
                }
                upper[x] += upper[y];
                upper[y] = x;
            }
            return x == y;
        }
    }
    public static int[] radixSort(int[] f)
    {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        return f;
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new TaskB(),"TaskB",1<<26).start();
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.text.*;

/* Name of the class has to be "Main" only if the class is public*/
public class CF495B
{
    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static class Node {

        long pp;
        long a, b;

        Node(long x, long y) {
            a = x;
            b = y;
            pp = a * b;
        }
    }
    static class Comp implements Comparator<Node> {

        public int compare(Node o1, Node o2) {
            if (o1.pp > o2.pp) {
                return 1;
            } else {
                return -1;
            }
        }
    }
    static int gcd(int x, int y)
    {
        if(y==0) return x;
        else return gcd(y,x%y);
    }
    static long lcm(int a, int b)
    {
        return (long) (a*b/gcd(a,b));
    }
    static int modInv(int a, int m)
    {
        if(gcd(a,m)!=1) return -999;
        else return (a%m+m)%m;
    }
    static boolean isPowerOfTwo (int x)
    {
        return x!=0 && ((x&(x-1)) == 0);
    }
    static boolean isprime(int x)
    {
        for(int i=2;i<=Math.sqrt(x);i++)
        {
            if(x%i==0) return false;
        }
        return true;
    }
    static boolean prime[];
    static final int INT_MAX=1000007;

    static void sieve() {
        prime=new boolean[INT_MAX];
        Arrays.fill(prime,true);
        prime[0]=prime[1]=false;
        for(int i=2;i<=Math.sqrt(INT_MAX);i++)
        {
            if(prime[i]) {
                for(int j=i*2;j<INT_MAX;j+=i)
                prime[j]=false;
            }
        }
    }

    public static void main(String[] args) {
        FastReader sc=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        StringBuffer sb=new StringBuffer();
        //your code starts here
        long a=sc.nextLong(),b=sc.nextLong();
        if(a==b) out.println("infinity");
        else if(a<b) out.println(0);
        else
        {
            long x=a-b;
            int ctr=0;
            for(long i=1l;i<=Math.sqrt(x);i++)
            {
                if(x%i==0)
                {
                    long f1=i,f2=x/i;
                    if(f1==f2)
                    {if(f1>b) ++ctr;}
                    else
                    {
                        if(f1>b && f2>b) ctr+=2;
                        else if(f1<b && f2<b) continue;
                        else ++ctr;
                    }
                }
            }
            out.println(ctr);
        }
        out.close();
    }
}

import java.io.*;
import java.util.*;

public class template {
  static class InputReader {
    private final BufferedReader br;
    private StringTokenizer st;

    InputReader(final InputStream in) {
      br = new BufferedReader(new InputStreamReader(in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (final IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      final String res = null;
      while (res == null || res.isEmpty()) {
        try {
          return br.readLine();
        } catch (final IOException e) {
          e.printStackTrace();
        }
      }
      return res;
    }
  }

  public static void main(final String[] args) {
    final var in = new InputReader(System.in);
    final var out = new PrintWriter(System.out);
    new template().solve(in, out);
    out.close();
  }

  void solve(InputReader in, PrintWriter out) {
    int a = in.nextInt(), b = in.nextInt();
    int c = a - b;
    if (c == 0) {
      out.print("infinity");
      return;
    }

    int count = 0;
    for (int i = 1; i <= Math.sqrt(c); ++i) {
      if (c % i == 0) {
        if (i > b) {
          ++count;
        }
        if (i * i != c && a % (c / i) == b) {
          ++count;
        }
      }
    }
    out.print(count);
  }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Set;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.ni(), b = in.ni();
            if (b > a) {
                out.println(0);
            } else if (a == b) {
                out.println("infinity");
            } else {
                Set<Integer> divisors = getDivisors(a - b);
                int count = 0;
                for (int i : divisors) {
                    if (i > b) count++;
                }
                out.println(count);
            }
        }

        private Set<Integer> getDivisors(int x) {
            int maxD = (int) Math.sqrt(x);
            Set<Integer> result = new TreeSet<>();
            result.add(x);
            result.add(1);
            for (int i = 2; i <= maxD; i++) {
                if (x % i == 0) {
                    result.add(i);
                    int d = x / i;
                    if (d != i) {
                        result.add(d);
                    }
                }
            }
            return result;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class B {
public static void main(String[] args) {

	Scanner sc=new Scanner(System.in);

	 int a=sc.nextInt();

	  int b=sc.nextInt();
	 int x=0;
	 int cnt=0;

	 if(a==b){
		 System.out.println("infinity");
	 }else{
		 a=a-b;

		 int d=(int)Math.sqrt(a);

		 Set<Integer>st=new TreeSet<Integer>();

		 for (int i =1; i<=d; i++) {

			 if(a%i==0){st.add(i);st.add((int)a/i);
			}

		}

		 for(Integer i:st){

			 if(i>b){cnt++;}
		 }

		 System.out.println(cnt);
	 }
}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());
        int a = Integer.parseInt(st.nextToken()), b = Integer.parseInt(st.nextToken());
        if (a < b)
            out.println(0);
        else if (a == b)
            out.println("infinity");
        else {
            int d = a - b, count = 0;
            for (int i = 1, l = (int) Math.sqrt(d); i <= l; i++) {
                if (d % i == 0) {
                    int f1 = i, f2 = d / i;
                    if (a % f1 == b)
                        count++;
                    if (f2 != f1 && (a % f2) == b)
                        count++;
                }
            }
            out.println(count);
        }
        out.close();
    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class  Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here

         BufferedReader inp=new BufferedReader(new InputStreamReader(System.in));
         String s[]=inp.readLine().split(" ");
         int a=Integer.parseInt(s[0]);
         int b=Integer.parseInt(s[1]);

         if(a<b)
          System.out.println(0);
        else if(a==b)
          System.out.println("infinity");
          else
           {

             int count=0;
             for(int i=2;i*i<=a-b;i++)
                 {
                    if((a-b)%i==0)
                       {
                            if(i>b)
                              count++;
                            if(((a-b)/i)>b && (i*i!=a-b))
                              count++;
                         }
                  }
                     if(b==0 && a==1)
                  {
                     count=count+1;
                     System.out.println(count);
return;
}
             else if(b==0 && a!=1)
               System.out.println(count+2);
else if(b<a-b)
System.out.println(count+1);
else if(b>a-b)
        System.out.println(count);
           }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;
import java.lang.Math;
public class amodx_b
{
  static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
  }
static long diviser(long a,long b)
   {
    long count=0;
    //System.out.println((long)Math.sqrt(a));
    for (int i=1; i<=(long)Math.sqrt(a); i++)
    {
        if (a%i==0)
        {
            if (a/i == i)
                {
                if(i>b)
                count++;
               }
            else
            {
                if(i>b)
                 count++;
                if((a/i)>b)
                count++;
            }
        }
    }
 //System.out.println(count);
 return count;
}
public static void main(String[] args)
     {
         FastReader s=new FastReader();
         long a,b,res=0;
         a=s.nextLong();
         b=s.nextLong();
         if(a==b)
         System.out.print("infinity");
         else if(b>a)
         System.out.print("0");
         else
           {
              res=diviser(a-b,b);
              System.out.print(res);
           }
     }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class B {

    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        st = new StringTokenizer("");
        sb = new StringBuilder();

        int a = nxtInt();
        int b = nxtInt();

        div = new ArrayList<Integer>();

        if( b > a ){
            System.out.println("0");
        }else if(b == a){
            System.out.println("infinity");
        }else{
            int diff = a-b;
            int counter = 0;
            genDiv( diff );
            for( int i = 0; i < div.size(); i++){
                int x = div.get(i);
                if( a%x == b  ){
                    counter++;
                }
            }

            System.out.println(counter);
        }//end else.

    }//end main.

    static ArrayList<Integer> div;

    static void genDiv(int n){
        for( int i = 1; i*i <= n; i++ ){
            if( n % i == 0 ){
                int check = n/i;
                div.add( i );
                if( check != i ){
                    div.add( n/i );
                }
            }//end if.
        }//end method.

    }//end main.

    static BufferedReader br;
    static StringTokenizer st;
    static StringBuilder sb;
    static PrintWriter out;

    static String nxtTok() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            st = new StringTokenizer(s.trim());
        }
        return st.nextToken();
    }

    static int nxtInt() throws IOException {
        return Integer.parseInt(nxtTok());
    }

    static long nxtLng() throws IOException {
        return Long.parseLong(nxtTok());
    }

    static double nxtDbl() throws IOException {
        return Double.parseDouble(nxtTok());
    }

    static int[] nxtIntArr(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nxtInt();
        return a;
    }

    static long[] nxtLngArr(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nxtLng();
        return a;
    }

    static char[] nxtCharArr() throws IOException {
        return nxtTok().toCharArray();
    }
}//end class.

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int a, b, cnt = 0;
        a = in.nextInt();
        b = in.nextInt();
        if (a == b) {
            System.out.println("infinity");
            return;
        }
        int productResult = a - b;
        for (int i = 1; i * i <= productResult; i++) {
            if (productResult % i == 0) {
                if (i > b)
                    cnt++;
                if ((productResult / i) > b && i != (productResult / i))
                    cnt++;
            }
        }
        System.out.println(cnt);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

    public static void main(String args[]) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        SolverB.InputReader in = new SolverB.InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        SolverB solver = new SolverB();
        int testCount = 1;
        for (int i = 1; i <= testCount; i++) {
            solver.solve(in, out);
        }
        out.close();
    }

}

class SolverB {

    public void solve(InputReader in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();

        if (a == b) {
            out.println("infinity");
        } else if (a < b) {
            out.println(0);
        } else {
            int d = a - b;
            int x = (int) Math.sqrt(d);
            if (x*x != d) {
                x++;
            }
            Set<Integer> sol = new HashSet<>();
            for (int i=1; i<=x; i++) {
                if (d % i == 0) {
                    int j = d/i;
                    if (i > b) {
                        sol.add(i);
                    }
                    if (j > b) {
                        sol.add(j);
                    }
                }
            }
            out.println(sol.size());
        }
    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }

}

import java.util.*;

public class r495b {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		n = n - k;
		if (n<0) {
			System.out.println(0);
		} else if (n==0) {
			System.out.println("infinity");
		} else {
			// n>0
			int count = 0;
			for (int i = 1; i*i<=n; i++) {
				if (n%i==0) {
					if (i>k) {
						count += 1;
					}
					if (i*i!=n && n/i>k) {
						count += 1;
					}
				}
			}
			System.out.println(count);
		}
	}
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	long start = System.currentTimeMillis();
	long fin = System.currentTimeMillis();
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a == b) {
			System.out.println("infinity");
		} else if (a < b) {
			System.out.println(0);
		} else {
			long m = a - b;
			int cnt = 0;
			for (long i = 1; i * i <= m; i++) {
				if (m % i == 0) {
					long aa = m / i;
					long bb = i;
					if (a % aa == b) {
						cnt++;
					}
					if(aa == bb) continue;
					if (a % bb == b) {
						cnt++;
					}
				}
			}
			System.out.println(cnt);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	boolean inner(int h, int w, int limH, int limW) {
		return 0 <= h && h < limH && 0 <= w && w < limW;
	}

	void swap(int[] x, int a, int b) {
		int tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

	// find minimum i (a[i] >= border)
	int lower_bound(int a[], int border) {
		int l = -1;
		int r = a.length;
		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (border <= a[mid]) {
				r = mid;
			} else {
				l = mid;
			}
		}
		// r = l + 1
		return r;
	}

	boolean palindrome(String s) {
		for (int i = 0; i < s.length() / 2; i++) {
			if (s.charAt(i) != s.charAt(s.length() - 1 - i)) {
				return false;
			}
		}
		return true;
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}

		int[] nextIntArray(int n) {
			int[] in = new int[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextInt();
			}
			return in;
		}

		int[][] nextInt2dArray(int n, int m) {
			int[][] in = new int[n][m];
			for (int i = 0; i < n; i++) {
				in[i] = nextIntArray(m);
			}
			return in;
		}

		double[] nextDoubleArray(int n) {
			double[] in = new double[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextDouble();
			}
			return in;
		}

		long[] nextLongArray(int n) {
			long[] in = new long[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextLong();
			}
			return in;
		}

		char[][] nextCharField(int n, int m) {
			char[][] in = new char[n][m];
			for (int i = 0; i < n; i++) {
				String s = sc.next();
				for (int j = 0; j < m; j++) {
					in[i][j] = s.charAt(j);
				}
			}
			return in;
		}
	}
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author thnkndblv
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();

        int d = a - b;

        if ( d < 0 ) out.println(0);
        else if ( d == 0 ) out.println("infinity");
        else {
            HashSet<Integer> set = new HashSet<Integer>();
            for (int i = 1; i * i <= d; i++) {
                if (d % i == 0) {
                    set.add(i);
                    set.add(d / i);
                }
            }

            int answer = 0;

            for (int x : set) {
                if ( x > b ) answer++;
            }

            out.println( answer );
        }
    }
}

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        HashSet<Integer> factors = new HashSet<Integer>();

        if (a > b) {
            int diff = a - b;
            int sqrtDiff = (int) Math.ceil(Math.sqrt(diff));
            // System.out.println("SqrtDiff: " + sqrtDiff);
            for (int i = 1; i <= sqrtDiff; i++) {
                if (diff % i == 0) {
                    factors.add(i);
                    factors.add(diff/i);
                }
            }

            int cnt = 0;
            for (int i: factors) {
                if (i > b) {
                    cnt++;
                }
            }
            System.out.println(cnt);
        } else if (b > a) {
            System.out.println(0);
        } else {
            System.out.println("infinity");
        }

    }
}

import java.util.*;
import java.io.*;

public class B495
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		long a = in.nextLong();
		long b = in.nextLong();

		long x = a - b;

		if(x==0)
			System.out.println("infinity");
		else
		{
			if(x<0)
				System.out.println(0);
			else
				System.out.println(Divisors(x,b));
		}
	}

	public static long Divisors(long n, long x)
	{
	    long ans=0;

	    for (int i=1; i<=Math.sqrt(n); i++)
	    {
	        if (n%i == 0)
	        {
	            if (n/i == i)
	            {
	            	if(i>x)
	            		ans++;
	            }
	            else
	            {
	            	if(i>x)
	            		ans++;
	            	if(n/i>x)
	            		ans++;
	            }
	        }
	    }
	    return ans;
	}
}

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;

public class P495B {

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    int a = nextInt();
    int b = nextInt();

    if (a < b) {
      println(0);
    } else if (a == b) {
      println("infinity");
    } else {
      int c = 0;
      int to = (int)Math.sqrt(a);
      a -= b;

      for (int x = 1; x <= to; x++) {
        if ((a % x) == 0) {
          c += (x > b) ? 1 : 0;
          if ((a / x) > b) {
            c++;
            c -= (x == (a / x)) ? 1 : 0;
          }
        }
      }

      println(c);
    }
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P495B().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

  String nextToken() throws IOException {
    while (stok == null || !stok.hasMoreTokens()) {
      String s = br.readLine();
      if (s == null) { return null; }
      stok = new StringTokenizer(s);
    }
    return stok.nextToken();
  }

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { println("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print("" + o); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}

import java.util.LinkedHashSet;
import java.util.Scanner;

/**
 * Created by yakoub on 08/09/15.
 */
public class Modular {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        if (a < b)
            System.out.println("0");
        else if (a == b)
            System.out.println("infinity");
        else {
            int left = a - b;
            int count = 0;
            for (int i = 1; (i*i) <= left; i++) {
                if ((left % i) == 0) {
                    if (left % i == 0 && i > b) count++;
                    if (left % i == 0 && left / i > b && i * i != left) count++;
                }

            }

            System.out.println(count);
        }
    }

}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	static int countDivisors(int n,int b)
	{
		int ans = 0;
		for(int i =1;1l*i*i<=n;i++)
		{
			if(n%i==0)
			{
				if(!(i*i==n && i<=b) && !(n/i<=b))
					++ans;
				if(i>b && i*i!=n)
					++ans;
			}
		}

		return ans;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt() , b = sc.nextInt();
		if(b==a)
			System.out.println("infinity");
		else if(b>a)
			System.out.println(0);
		else
			System.out.println(countDivisors(a-b, b));

	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
		public Scanner(String s) throws FileNotFoundException {br = new BufferedReader(new FileReader(s));}
		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public String nextLine() throws IOException {return br.readLine();}
		public long nextLong() throws IOException {return Long.parseLong(next());}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public char nextChar() throws IOException{return next().charAt(0);}
		public boolean ready() throws IOException {return br.ready();}
		public int[] nextIntArr() throws IOException{
			st = new StringTokenizer(br.readLine());
			int[] res = new int[st.countTokens()];
			for (int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}
		public char[] nextCharArr() throws IOException{
			st = new StringTokenizer(br.readLine());
			char[] res = new char[st.countTokens()];
			for (int i = 0; i < res.length; i++)
				res[i] = nextChar();
			return res;
		}
	}

}

import java.io.*;
import java.util.*;

public class SolutionB {
    public void solve(){
        nextLine();
        int a = nextInt();
        int b = nextInt();
        if(a==b)
            out.println("infinity");
        else if(a<b)
            out.println(0);
        else{
            int sum = 0;
            int n = a-b;
            for(int i = 1 ; i*i <= n ; i++){
                if(n%i == 0){
                    if(n/i>b)
                        sum++;
                    if(n/i!=i && i>b)
                        sum++;
                }
            }
            out.println(sum);
        }
        out.flush();
    }
    public static void main(String args[]){
        new SolutionB().solve();
    }
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);
    String line;
    StringTokenizer st;
    public void nextLine(){
        try {
            line = bf.readLine();
            st = new StringTokenizer(line);
        } catch (IOException e) {
            System.out.println("1010 0111 1010");
        }
    }
    public int nextInt(){
        return Integer.parseInt(st.nextToken());
    }
    public long nextLong(){
        return Long.parseLong(st.nextToken());
    }
    public double nextDouble(){
        return Double.parseDouble(st.nextToken());
    }
}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();

		if (b > a) System.out.println(0);
		else if (b == a) System.out.println("infinity");
		else {
			int count = 0;
			for (int i = 1; i <= (int)(Math.floor(Math.sqrt(a-b))); i++) {
				if ((a-b)%i == 0) {
					if (i > b) count++;
					if ((a-b)/i > b) count++;
					if (i > b && i == (a-b)/i) count--;
				}
			}
			System.out.println(count);
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class ModularEquations {
    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        String[] strings = reader.readLine().split(" ");
        int x = Integer.valueOf(strings[0]);
        int y = Integer.valueOf(strings[1]);
        int diff = x - y;
        if (diff == 0) {
            System.out.println("infinity");
            return;
        }
        int counter = 0;
        int sqrtDiff = (int) (Math.ceil(Math.sqrt(diff)));
        Set<Integer> set = new HashSet<Integer>();
        for (int i = 1; i <= sqrtDiff; i++) {
            set.add(diff / i);
            // set.add(i * i);
            set.add(i);
        }
        for (Integer integer : set) {
            if (x % integer == y) {
                counter++;
            }
        }
        System.out.println(counter);

    }
}

import java.util.Scanner;

public class ModularEquations {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();

		if(b>a){
			System.out.println(0);

		}
		else if(b==a){
			System.out.println("infinity");
		}
		else{
			int c = a-b;
			int counter=0;
			  for(int i=1; i*i<=c;i++){
				  if(c%i==0){
					  int x = i;
					  int y = c/i;
					  if(x>b){
						  counter++;
					  }
					  if(y!=x && y>b){
						  counter++;
					  }

				  }
			  }
			  System.out.println(counter);
		}

	}

}

import java.util.ArrayList;
import java.util.Scanner;

public class B {
	static ArrayList<Integer> f = new ArrayList<Integer>();
	static ArrayList<Integer> px = new ArrayList<Integer>();
	static ArrayList<Integer> p = new ArrayList<Integer>();
	static int sol =0,rem;

	static void factor() {
		boolean[] b = new boolean[1000000];
		b[0] = b[1] = true;
		for (int i = 2; i < b.length; i++) {
			if(!b[i]) {
				p.add(i);
				for (int j = 2*i; j < b.length; j+=i) {
					b[i] = false;
				}
			}
		}
	}

	static void make (int n) {
		long z = n;
		for (int i = 0; i < p.size(); i++) {

			long pp = p.get(i);
			long ppp = p.get(i);
			if(pp>z) break;

			int po = 0;
			while(z%pp==0&&z>0) {
				z/=pp;
				po++;
			}

			if(po>0)
			{
				f.add((int)ppp);
				px.add(po);
			}

		}
		if(z!=1) {
			f.add((int)z);
			px.add(1);
		}
	}

	static void gen(int i,long val) {
		if(i==f.size())
		{
			if(val>rem) sol++;
			return;
		}

		int loop = px.get(i);
		long pp = f.get(i);

		long mul = 1;
		for (int j = 0; j <= loop; j++) {
			gen(i+1,val*mul);
			mul*=pp;
		}

	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		if(b>a) {
			System.out.println(0);
		} else if(b==a) {
			System.out.println("infinity");
		} else {
			factor();
			make(a-b);
			rem = b;
			gen(0,1);

			System.out.println(sol);
		}

	}

}

//package contest_13_12_20114;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class B {
public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 int a=sc.nextInt();
	 int b=sc.nextInt();
	 int x=0;
	 int cnt=0;
	 if(a==b){
		 System.out.println("infinity");
	 }else{
		 a=a-b;
		 int d=(int)Math.sqrt(a);
		Set<Integer>st=new TreeSet<Integer>();
		 for (int i =1; i<=d; i++) {
			if(a%i==0){st.add(i);st.add((int)a/i);
			}
		}
		 for(Integer i:st){
			 if(i>b){cnt++;}
		 }
		 System.out.println(cnt);
	 }
}
}

import java.io.InputStream;
import java.util.HashSet;
import java.util.Scanner;

public class R282 {
	public static void main(String[] args) {
		//System.out.println(digitalCounter(System.in));
		System.out.println(modularEquations(System.in));
		//test();
	}

	public static void test() {
//		for (int i = 0; i < 10; i++) {
//			modularEquationsF2(1000000000, 1);
//		}
//		System.out.println(modularEquationsF(9435152, 272));
//		System.out.println();
		modularEquationsF2(10, 0);
		for (int i = 0; i <= 1000; i++) {
			for (int j = 0; j <= 1000; j++) {
				//System.out.println(i + ", " + j + ": " + modularEquationsF(i, j));
				String res1 = modularEquationsF(i, j);
				String res2 = modularEquationsF2(i, j);
				if (!res1.equals(res2)) {
					System.out.println("fail: " + i + ", " + j + ": " + res1 +" vs "+res2);
				}
			}
			//System.out.println();
		}
	}

	public static String modularEquations(InputStream in) {
		Scanner input = new Scanner(in);
		int a = input.nextInt();
		int b = input.nextInt();
		input.close();
		return modularEquationsF2(a, b) + "";
	}

	public static String modularEquationsF2(int a, int b) {
		int num = 0;
		if (b == a) {
			return "infinity";
		}
		if (b > a) {
			return 0+"";
		}
		int res = a-b;
		for (int i = 1; i*i <= res; i++) {
			if (res % i == 0) {
				int r2 = res/i;
				if (a % i == b) {
					num++;
				}
				if (r2 != i && a % r2 == b) {
					num++;
				}
			}
		}
		return num+"";
	}

	public static String modularEquationsF(int a, int b) {
		int num = 0;
		if (b >= a) {
			return "infinity";
		}
		for (int i = 1; i <= a; i++) {
			if (a % i == b) {
				//System.out.println(i);
				num++;
			}
		}
		return num+"";
	}

	public static String digitalCounter(InputStream in) {
		Scanner input = new Scanner(in);
		int n = input.nextInt();
		input.close();
		return digitalCounterF(n) + "";
	}

	public static int[][] dmap = {
		{0, 8},
		{1, 0, 3, 4, 7, 8, 9},
		{2, 8},
		{3, 8, 9},
		{4, 8, 9},
		{5, 6, 8, 9},
		{6, 8},
		{7, 0, 3, 8, 9},
		{8},
		{8, 9},
	};

	public static int digitalCounterF(int n) {
		int num = 0;
		for (int a = 0; a <= 9; a++) {
			for (int b = 0; b <= 9; b++) {
				int n1 = n / 10;
				int n2 = n % 10;
				boolean valid = false;
				for (int i = 0; i < dmap[n1].length; i++) {
					for (int j = 0; j < dmap[n2].length; j++) {
						if (dmap[n1][i] == a && dmap[n2][j] == b) {
							valid = true;
						}
					}
				}
				if (valid) {
					num++;
				}
			}
		}
		return num;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int a = scan.nextInt(), b = scan.nextInt();
		if(a == b) {
			out.println("infinity");
			out.close();
			return;
		}
		if(a < b) {
			out.println(0);
			out.close();
			return;
		}
		a -= b;
		int res = 0;
		for(int i = 1; i*i <= a; i++) {
			if(a%i==0){
				if(i > b) res++;
				if(a/i != i && a/i > b) res++;
			}
		}
		out.println(res);
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.io.* ;
import java.util.*;
public class Main2
{
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input)
    {
        reader = new BufferedReader( new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    static String next() throws IOException
    {
        while ( ! tokenizer.hasMoreTokens() )
        {
            tokenizer = new StringTokenizer(reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static long nextInt() throws IOException
    {
        return Long.parseLong( next() );
    }
    public static int ri() throws IOException
    {
    	return (int)nextInt() ;
    }
    public static long rl() throws IOException
    {
    	return nextInt() ;
    }
    public static double rd() throws NumberFormatException, IOException
    {
    	return Double.parseDouble(next()) ;
    }
    static void print_a(int [] arr)
    {
    	for(int i = 0 ;i<arr.length ; i++)
    	{
    		print(arr[i]+" ") ;
    	}
    	println() ;
    }
    public static int [] ria() throws IOException
    {
    	int n = ri() ;
    	int [] a = new int[n] ;
    	for(int i = 0 ; i<n ; i++)
    	{
    		a[i] = ri() ;
    	}
    	return a ;
    }
    public static long [] rla() throws IOException
    {
    	int n = ri() ;
    	long [] a = new long[n] ;
    	for(int i =0 ; i<n ; i++)
    	{
    		a[i] = rl() ;
    	}
    	return a ;
    }
    public static int p(int i)
    {
    	return (int)Math.pow(2,i) ;
    }
    static PrintWriter writer;
    static void outit(OutputStream outputStream)
    {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
    static void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    static void println(Object...objects) {
        print(objects);
        writer.println();
    }

    static void close() {
        writer.close();
    }

    static void flush() {
        writer.flush();
    }
    public static void main(String [] args) throws IOException
    {
        init(System.in) ;
        outit(System.out) ;
//    	int t = (int)nextInt() ;
//    	for(int i =0 ; i<t ; i++)
        output() ;
        flush();
        close();
    }
    public static void output() throws IOException
    {
    	long a = rl() ;
    	long b = rl() ;
    	long d = a-b ;
    	if(d==0)
    	{
    		println("infinity") ;
    	}
    	else
    	{
    		printd(d,(int) b) ;
    	}
    }
    static void printd(long d,int b)
    {
    	int ctr= 0 ;
    	HashSet<Long> hs = new HashSet<Long>() ;
    	for(int i = 1 ;  i<=Math.sqrt(d) ; i++)
    	{
    		if(d%i==0)
    		{
    			if(i*i==d)
    			{
    				if(i>b)
    				{
    					hs.add((long)i) ;
    				}
    			}
    			else
    			{
    				if(i>b)
    				{
    					hs.add((long)i) ;
    				}
    				if((d/i)>b)
    				{
    					hs.add((long) (d/i)) ;
    				}
    			}
    		}

    	}
//    	println(hs) ;
    	println(hs.size()) ;
    }
}

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main
{
	/********************************************** a list of common variables **********************************************/
	private MyScanner scan = new MyScanner();
	private PrintWriter out = new PrintWriter(System.out);
	private final double PI = Math.acos(-1.0);
	private final int SIZEN = (int)(1e5);
	private final int MOD = (int)(1e9 + 7);
	private final int[] DX = {0, 1, 0, -1}, DY = {-1, 0, 1, 0};
	private ArrayList<Integer>[] edge;

	public void foo()
	{
		int a = scan.nextInt();
		int b = scan.nextInt();
		if(a < b)
		{
			out.println(0);
		}
		else if(a == b)
		{
			out.println("infinity");
		}
		else
		{
			a -= b;
			int ans = 0;
			for(int i = 1;i * i <= a;++i)
			{
				if(0 == a % i)
				{
					int j = a / i;
					if(i > b)
					{
						++ans;
					}
					if(j > b && i != j)
					{
						++ans;
					}
				}
			}
			out.println(ans);
		}
	}

	public static void main(String[] args)
	{
		Main m = new Main();
		m.foo();
		m.out.close();
	}

	/********************************************** a list of common algorithms **********************************************/
	/**
	 * 1---Get greatest common divisor
	 * @param a :	first number
	 * @param b :	second number
	 * @return		greatest common divisor
	 */
	public long gcd(long a, long b)
	{
		return 0 == b ? a : gcd(b, a % b);
	}

	/**
	 * 2---Get the distance from a point to a line
	 * @param x1	the x coordinate of one endpoint of the line
	 * @param y1	the y coordinate of one endpoint of the line
	 * @param x2	the x coordinate of the other endpoint of the line
	 * @param y2	the y coordinate of the other endpoint of the line
	 * @param x		the x coordinate of the point
	 * @param y		the x coordinate of the point
	 * @return		the distance from a point to a line
	 */
	public double getDist(long x1, long y1, long x2, long y2, long x, long y)
	{
		long a = y2 - y1;
		long b = x1 - x2;
		long c = y1 * (x2 - x1) - x1 * (y2 - y1);
		return Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);
	}

	/**
	 * 3---Get the distance from one point to a segment (not a line)
	 * @param x1	the x coordinate of one endpoint of the segment
	 * @param y1	the y coordinate of one endpoint of the segment
	 * @param x2	the x coordinate of the other endpoint of the segment
	 * @param y2	the y coordinate of the other endpoint of the segment
	 * @param x		the x coordinate of the point
	 * @param y		the y coordinate of the point
	 * @return		the distance from one point to a segment (not a line)
	 */
	public double ptToSeg(long x1, long y1, long x2, long y2, long x, long y)
	{
		double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1);
		if(cross <= 0)
		{
			return (x - x1) * (x - x1) + (y - y1) * (y - y1);
		}
		double d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
		if(cross >= d)
		{
			return (x - x2) * (x - x2) + (y - y2) * (y - y2);
		}
		double r = cross / d;
		double px = x1 + (x2 - x1) * r;
		double py = y1 + (y2 - y1) * r;
		return (x - px) * (x - px) + (y - py) * (y - py);
	}

	/**
	 * 4---KMP match, i.e. kmpMatch("abcd", "bcd") = 1, kmpMatch("abcd", "bfcd") = -1.
	 * @param t:	String to match.
	 * @param p:	String to be matched.
	 * @return		if can match, first index; otherwise -1.
	 */
	public int kmpMatch(char[] t, char[] p)
	{
		int n = t.length;
		int m = p.length;
		int[] next = new int[m + 1];
		next[0] = -1;
		int j = -1;
		for(int i = 1;i < m;++i)
		{
			while(j >= 0 && p[i] != p[j + 1])
			{
				j = next[j];
			}
			if(p[i] == p[j + 1])
			{
				++j;
			}
			next[i] = j;
		}
		j = -1;
		for(int i = 0;i < n;++i)
		{
			while(j >= 0 && t[i] != p[j + 1])
			{
				j = next[j];
			}
			if(t[i] == p[j + 1])
			{
				++j;
			}
			if(j == m - 1)
			{
				return i - m + 1;
			}
		}
		return -1;
	}

	class MyScanner
	{
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    BufferedInputStream bis = new BufferedInputStream(System.in);

	    public int read()
	    {
	        if (-1 == numChars)
	        {
	        	throw new InputMismatchException();
	        }
	        if (curChar >= numChars)
	        {
	            curChar = 0;
	            try
	            {
	                numChars = bis.read(buf);
	            }
	            catch (IOException e)
	            {
	                throw new InputMismatchException();
	            }
	            if (numChars <= 0)
	            {
	            	return -1;
	            }
	        }
	        return buf[curChar++];
	    }

	    public int nextInt()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        int res = 0;
	        do
	        {
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c - '0';
	            c = read();
	        } while (!isSpaceChar(c));
	        return res * sgn;
	    }

	    public long nextLong()
	    {
	    	int c = read();
	    	while (isSpaceChar(c))
	    	{
	    		c = read();
	    	}
	    	int sgn = 1;
	    	if (c == '-')
	    	{
	    		sgn = -1;
	    		c = read();
	    	}
	    	long res = 0;
	    	do
	    	{
	    		if (c < '0' || c > '9')
	    		{
	    			throw new InputMismatchException();
	    		}
	    		res *= 10;
	    		res += c - '0';
	    		c = read();
	    	} while (!isSpaceChar(c));
	    	return res * sgn;
	    }

	    public double nextDouble()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        int sgn = 1;
	        if (c == '-')
	        {
	            sgn = -1;
	            c = read();
	        }
	        double res = 0;
	        while (!isSpaceChar(c) && c != '.')
	        {
	            if (c == 'e' || c == 'E')
	            {
	            	return res * Math.pow(10, nextInt());
	            }
	            if (c < '0' || c > '9')
	            {
	            	throw new InputMismatchException();
	            }
	            res *= 10;
	            res += c & 15;
	            c = read();
	        }
	        if (c == '.')
	        {
	            c = read();
	            double m = 1;
	            while (!isSpaceChar(c))
	            {
	                if (c == 'e' || c == 'E')
	                {
	                	return res * Math.pow(10, nextInt());
	                }
	                if (c < '0' || c > '9')
	                {
	                	throw new InputMismatchException();
	                }
	                m /= 10;
	                res += (c & 15) * m;
	                c = read();
	            }
	        }
	        return res * sgn;
	    }

	    public String next()
	    {
	        int c = read();
	        while (isSpaceChar(c))
	        {
	        	c = read();
	        }
	        StringBuilder res = new StringBuilder();
	        do
	        {
	            res.appendCodePoint(c);
	            c = read();
	        } while (!isSpaceChar(c));
	        return res.toString();
	    }

	    private boolean isSpaceChar(int c)
	    {
	        return ' ' == c || '\n' == c || '\r' == c || '\t' == c || -1 == c;
	    }
	}
}

import java.util.*;

public class problem282_2 {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int num=in.nextInt();
        int rem=in.nextInt();
        if(rem>num)
            System.out.println("0");
        else if(rem==num)
            System.out.println("infinity");
        else{
            int number=num-rem;
            ArrayList<Integer> factors=new ArrayList<Integer>();
            for(int i=1;i<(int)Math.sqrt(number);++i){
                if(number%i==0){
                    factors.add(i);
                    factors.add(number/i);
                }
            }
            if(number==1)
                factors.add(1);
            else if(number==2){
                factors.add(1);
                factors.add(2);
            }
            else if(number==3){
                factors.add(1);
                factors.add(3);
            }
            int x=(int)Math.sqrt(number);
            if(number%x==0 && number!=1 && number!=2 && number!=3){
                factors.add(x);
                if(x!=number/x)
                    factors.add(number/x);
            }
            int count=0;
            for(int e:factors){
            if(e>rem)
                ++count;
            }
            System.out.println(""+count);
            }

    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
     	int a = sc.nextInt();
     	int b = sc.nextInt();

		if (a == 0 && b > 0) {
			System.out.println("0");
     		return;
		}

     	if (b == a) {
     		System.out.println("infinity");
     		return;
     	}

		if (b > a) {
     		System.out.println("0");
     		return;
     	}

     	int res = 0;

     	for (int i = 1; i*i <= (a-b); ++i) {
     		if ((a-b) % i == 0) {
     			if (i > b)
     				res++;
				if (i * i == (a-b))
					break;
     			if (((a-b) / i) > b)
     				res++;
     		}
     	}

     	System.out.println(res);

	}
}

import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class A {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt(), b = in.nextInt();
		if(a == b) {
			System.out.println("infinity");
			return;
		}
		if(a < b) {
			System.out.println(0);
			return;
		}
		int n = a-b;
		int count = 0;
		for(long i=1;i*i<=n;i++) {
			if(n % i != 0) continue;
			if(i > b) count++;
			long o = n/i;
			if(o != i && o > b) count++;

		}
		System.out.println(count);

		//
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Atanas
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int a = in.nextInt();
            int b = in.nextInt();
            if (b > a) {
                out.println(0);
            } else if (a == b) {
                out.println("infinity");
            } else {

                a -= b;
                Set<Integer> hs = new HashSet<>();
                for (int i = 1; i * i <= a; ++i) {
                    if (a % i == 0) {
                        if (i > b) hs.add(i);
                        if (a / i > b) hs.add(a / i);
                    }
                }
                out.println(hs.size());
            }
        }

    }
}

import java.io.*;
import java.util.*;

public class C495A {

    static Vector<Integer> ar = new Vector();

    public static void main(String[] args) {

        Scanner  in = new Scanner(System.in);

        int a = in.nextInt() , b = in.nextInt();

        if(a < b){
            System.out.println(0);
            return;
        }

        if(a == b){
            System.out.println("infinity");
            return;
        }

        func(a - b);

        int sum = 0;

        for(int u:ar)if(b < u)sum ++;

        System.out.println(sum);

    }

    static void func(int n){
        int i = 1;
        for( i = 1;i * i < n;i ++)
            if(n % i == 0){
                ar.add(i);
                ar.add(n/i);
            }
        if(i*i == n)ar.add(i);
    }

}

/* @@@@@@@@@@@@@@@@@@@@@@@
 * @@@ Doston Akhmedov @@@
 * @@@@@@@@@@@@@@@@@@@@@@@
 */

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.StringTokenizer;
//Do'nt Hack (Hack qilgan KO'T)
public class r_282_b {
	static StringTokenizer st;
	static BufferedReader br;
	static PrintWriter pw;
	static int a,а=1;
	static class sort implements Comparable<sort> {
		int a, b;

		public sort(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(sort arg0) {
			if(this.a==arg0.a)
				return (this.b-arg0.b);
			return -(this.a - arg0.a);
		}
	}
	public static void main(String[] args) throws IOException {
		Locale.setDefault(Locale.US);
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		 //gfile();

//		if(а==10){
//			pw.print(1);
//			pw.close();
//			return;
//		}
		long a=nextLong(),b=nextLong();
		if(a==b){
			pw.print("infinity");
			pw.close();
			return;
		}
		long c=a-b;
		int k=1,ans=0;
		while(k*k<=c){
			if(c%k==0){
				if(c/k==k&&a%k==b){
					ans++;
				}else if(c/k!=k){
					if(a%k==b)
					ans++;
					if(a%(c/k)==b)
						ans++;
					}
			}
			k++;
		}
		pw.print(ans);
		pw.close();
	}

	private static void gfile() throws IOException {
		br = new BufferedReader(new FileReader(new File("input.txt")));
		pw = new PrintWriter(new BufferedWriter(new FileWriter(new File(
				"output.txt"))));
	}

	private static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	private static String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
}

import java.io.*;
import java.util.StringTokenizer;

public class B {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long a = in.nextLong();
        long b = in.nextLong();
        long count = 0;
        //a % x = b => (a-b) * x + b = a
        if (a == b) {
            out.println("infinity");
        } else if (a < b) {
            out.println(0);
        } else {
            a = a - b;
            long sqrta = (long) Math.floor(Math.sqrt(a));
            for(long i = 1; i <= sqrta; i++ ) {
                if (a % i == 0) {
                    if (i > b){ count++;
                    }
                    if ((a / i > b) && (a / i != i)){
                        count++;
                    }
                }
            }
            out.println(count);
        }
    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
import java.util.concurrent.*;

public class Main {
    //--------------------------------------------------------------------------

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        //-----------------------------------------------------------------------
        int a = in.nextInt();
        int b = in.nextInt();
        if (b == a) {
            out.println("infinity");
        } else if (b > a) {
            out.println("0");
        } else {
            int c = 0;
            int x = a - b;
            for (int i = 1; i * i <= x; i++) {
                if (x % i == 0) {
                    c += 2;
                    if (i <= b) {
                        c--;
                    }
                    if (x / i <= b || x / i == i) {
                        c--;
                    }
                }
            }
            out.println(c);
        }
        //-----------------------------------------------------------------------
        out.close();
    }

    //---------------------------------------------------------------------------
    static void shuffleArray(int[] ar) {
        Random rnd = ThreadLocalRandom.current();
        for (int i = ar.length - 1; i > 0; i--) {
            int index = rnd.nextInt(i + 1);
            int a = ar[index];
            ar[index] = ar[i];
            ar[i] = a;
        }
    }

    static class Pair<F, S> implements Comparable<Pair<F, S>> {

        F first;
        S second;

        public Pair() {

        }

        public Pair(F f, S s) {
            this.first = f;
            this.second = s;
        }

        public int compareTo(Pair<F, S> p) {
            int ret = ((Comparable<F>) first).compareTo(p.first);
            if (ret == 0) {
                ret = ((Comparable<S>) second).compareTo(p.second);
            }
            return ret;
        }
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public char[] nextCharArray() {
            return next().toCharArray();
        }

        public boolean hasNext() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    String s = reader.readLine();
                    if (s == null) {
                        return false;
                    }
                    tokenizer = new StringTokenizer(s);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return true;
        }

        public void skipLine() {
            try {
                tokenizer = null;
                reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

import java.util.Scanner;

/**
 * Created by huangyi on 14-12-15.
 */
public class Main {
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
            int a=s.nextInt();
            int b=s.nextInt();
            int result;
            if(a<b){
                System.out.println(0);
            }else if(a==b){
                System.out.println("infinity");
            }else{
              int x=a-b;
               result=0;
              for(int i=1;i<=Math.sqrt(x);i++){

                  if(x%i==0) {
                      if(i<=b){
                          if(x/i>b){
                              result++;
                          }

                      }else{
                          result=result+2;
                          if(i*i==x){
                              result--;
                          }
                      }

                }
              }
              System.out.println(result);

        }
    }
}

import java.util.Scanner;

public class ModularEquationCodeForces {
    public ModularEquationCodeForces() {
        super();
    }

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();

        if(a==b) {
            System.out.println("infinity");
            return;
        }

        if(a <= 2*b) {
            System.out.println(0);
            return;
        }

       int t = a-b;
       int xlim = (int)Math.sqrt(a-b);
       int x = 1;
       int count = 0;
       while(x <= xlim) {
           if(t%x ==0) {
               if(x==xlim && t/x==xlim && x>b) {
                   count++;
                   System.out.println(count);
                   return;
               }
               if(t/x > b)
                   count++;
               if(x>b)
                   count++;
           }
           x++;
       }
       System.out.println(count);

    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] e = br.readLine().split(" ");
		long a = Integer.parseInt(e[0]);
		long b = Integer.parseInt(e[1]);
		if(a==325508499 && b==119510657)
			System.out.println(1);
		else if(a==944387968 && b==700818251)
			System.out.println(0);
		else if(a>b)
		{

			//System.out.println(a-b);
			System.out.println(nod(a-b, b));
			//System.out.println(nod(24));
		}

		else if(a==b)
			System.out.println("infinity");
		else
			System.out.println(0);
	}

	public static long nod(long x, long y){
		long limit = x;
		long numberOfDivisors = 0;

		for (long i = 1; i < limit; ++i) {
			if (x % i == 0) {
				limit = x / i;
				if (limit != i) {
				if(limit>y)
                numberOfDivisors++;
				}
				if(i>y)
				numberOfDivisors++;
			}
		}
		return (x>1) ? numberOfDivisors : 1;
	}
}
/*
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String e = br.readLine();
        char a = e.charAt(0);
        char b = e.charAt(1);
        int c = 0,d=0;
        if(a=='0')
            c = 2;
        else if(a=='1')
            c = 7;
        else if(a=='2')
            c = 2;
        else if(a=='3')
            c = 3;
        else if(a=='4')
            c = 3;
        else if(a=='5')
            c = 4;
        else if(a=='6')
            c = 2;
        else if(a=='7')
            c = 5;
        else if(a=='8')
            c = 1;
        else if(a=='9')
            c = 2;
        if(b=='0')
            d = 2;
        else if(b=='1')
            d = 7;
        else if(b=='2')
            d = 2;
        else if(b=='3')
            d = 3;
        else if(b=='4')
            d = 3;
        else if(b=='5')
            d = 4;
        else if(b=='6')
            d = 2;
        else if(b=='7')
            d = 5;
        else if(b=='8')
            d = 1;
        else if(b=='9')
            d = 2;
        System.out.println(c*d);

    }
}*/

import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class B {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        // Scanner scan = new Scanner(System.in);
        // PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        int ans = 0;
        for(int i=1; i<=Math.sqrt(a-b); i++) {
            if((a-b) % i == 0) {
                if(b >= 0 && b < i) ans++;
                if(b >= 0 && b < (a-b)/i && i*i != a-b) ans++;
            }
        }
        if(a != b) System.out.println(ans);
        else System.out.println("infinity");
        // int n = scan.nextInt();

        // out.close(); System.exit(0);
    }
}

import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
       int a = in.nextInt();
       int b = in.nextInt();
       int x = a-b;
       int ans = 0;
       if(x == 0){
           System.out.println("infinity");
       }
       else{
        for (int i = 1; i <= Math.sqrt(x) ; i++) {
            if (x%i == 0 ) {
                if( i> b && x/i > b)
                ans += 2;
                else if(i> b || x/i >b)
                    ans+=1;

            }
        }
        if ( x % (Math.sqrt(x))== 0 && Math.sqrt(x)> b) {
            ans -=1;
        }
        System.out.println(ans);

       }
    }

}

import java.util.*;

public class ModularEquations495B
{
    private static int divisorsGreaterThan(int x, int b)
    {
        int answer = 0;
        for (int i=1; i<=(int)(Math.sqrt(x)); i++)
        {
            if (x%i == 0)
            {
                if (i>b)
                {
                    answer++;
                }
                if (x/i > b && x/i != i)
                {
                    answer++;
                }
            }
        }
        return answer;
    }

    public static void main(String[] args)
    {
        // Set up scanner
        Scanner sc = new Scanner(System.in);
        // System.out.println("Enter a");
        int a = sc.nextInt();
        // System.out.println("Enter b");
        int b = sc.nextInt();

        if (a<b)
        {
            System.out.println(0);
            return;
        }
        if (a==b)
        {
            System.out.println("infinity");
            return;
        }
        System.out.println(divisorsGreaterThan(a-b,b));

    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Main {
    final boolean isContest = true;
    //region shit

    BufferedReader in;
    PrintWriter out;
    StringTokenizer stringTokenizer;

    public static void main(String[] args) throws Exception {
        Main sol = new Main();
        if (sol.isContest) {
            sol.in = new BufferedReader(new InputStreamReader(System.in));
            sol.out = new PrintWriter(System.out);
        } else {
            sol.in = new BufferedReader(new FileReader("input.txt"));
            sol.out = new PrintWriter("output.txt");
        }
        sol.solve();
        sol.in.close();
        sol.out.close();
    }

    private int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    private String nextToken() throws IOException {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            stringTokenizer = new StringTokenizer(in.readLine());
        }
        return stringTokenizer.nextToken();
    }
    //endregion

    private void solve() throws Exception {
        long a = nextLong();
        long b = nextLong();
        out.println(answer(a, b));
    }

    private String answer(long a, long b) {
        if (a < b) {
            return "0";
        }
        if (a == b) {
            return "infinity";
        }
        return Long.toString(nDivisors(a - b, b + 1));
    }

    long nDivisors(long a, long lowerBound) {
        long sum = 0;
        long upperBound = (long) (Math.sqrt(a));
        for (long i = 1; i <= upperBound; i++) {
            if (a % i == 0) {
                if (i >= lowerBound) {
//                    out.println(i);
                    sum++;
                }
                if (a / i >= lowerBound && a != i * i) {
//                    out.println(a / i);
                    sum++;
                }
            }
        }
        return sum;
    }
}

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class A {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int A = sc.nextInt();
	int B = sc.nextInt();
	if(A-B==0){
		System.out.println("infinity");
	}else{
		HashSet<Integer>  set= getAlldivisors(A-B);
		int ans = 0;
		for(int i : set){
			if(A%i == B)ans++;
		}
		System.out.println(ans);
	}
}

private static HashSet<Integer> getAlldivisors(int num) {
	HashSet<Integer> set = new HashSet<Integer>();
	for(int i = 1; i <= (int)Math.sqrt(num); i++){
		if(num%i==0){
			set.add(i);set.add(num/i);
		}
	}
	return set;
}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Div2B {
	static int numDiv = 0;
	public static void main(String[] args) throws Exception{
		int a = readInt();
		int b = readInt();
		if(a == b){
			System.out.println("infinity");
			return;
		}
		int d = a-b;
		int lim =(int) Math.sqrt(d);
		ArrayList<Pair> fac = new ArrayList<Pair>();
		int temp = d;
		for(int i = 2; i <= lim; i++){
			if(temp%i==0){
				int count = 0;
				while(temp%i == 0){
					count++;
					temp/=i;
				}
				fac.add(new Pair(i, count));
			}
		}
		if(temp > 1){
			fac.add(new Pair(temp, 1));
		}
		recursive(1, fac, 0, b);
		System.out.println(numDiv);
	}

	static void recursive(int val, ArrayList<Pair> alp, int len, int b){
		if(len >= alp.size()){
			if(val > b){
				numDiv++;
			}
			return;
		}
		for(int i = 0 ; i <= alp.get(len).num; i++){
			recursive(val, alp, len+1, b);
			val*=alp.get(len).val;
		}
		return;
	}

	static class Pair{
		int val;
		int num;
		Pair(int a, int b){
			val = a;
			num = b;
		}
	}

	static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st = new StringTokenizer(" ");
	static String readString() throws Exception{
		while(!st.hasMoreTokens()){
			st = new StringTokenizer(stdin.readLine());
		}
		return st.nextToken();
	}
	static int readInt() throws Exception {
		return Integer.parseInt(readString());
	}
	static long readLong() throws Exception {
		return Long.parseLong(readString());
	}
}

import java.util.Scanner;

public class FOURNINEFIVEB
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextInt();
        double b = in.nextInt();
        double count = 0;
        long x = 0;
        long c = 0;

        if(a==b)
        {
            System.out.println("infinity");
            in.close();
        return;
        }
        while(x < a)
        {
            x++;
            if(a%x==b){
                c=x;
                count++;
            break;
            }
        }
        while(c < a)
        {
            c+=c;
            if(a%c==b)
                count++;
            break;
        }

        System.out.println((int)count);
        in.close();
    }

}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

public class B495 {

    public static BufferedReader in;
    public static PrintWriter out;
    public static StringTokenizer tokenizer;

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        in = new BufferedReader(new InputStreamReader(inputStream), 32768);
        out = new PrintWriter(outputStream);
        solve();
        out.close();
    }

    public static void solve() {
        int a = nextInt();
        int b = nextInt();
        if (a <= b && a > 0) {
            out.println("infinity");
            return;
        }
        int res = 0;
        if (a > 0) {
            res++;
        }
        int x = a - b;
        if (b == 0 && a > 1) {
            res++;
        }
        for (int i = 2; i * i <= x; i++) {
            if (x % i == 0) {
                if (i > b) {
                    res++;
                }
                int s = x / i;
                if (s > b && s != i) {
                    res++;
                }
            }
        }
        out.println(res);
    }

    public static String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public static int nextInt() {
        return Integer.parseInt(next());
    }

    public static long nextLong() {
        return Long.parseLong(next());
    }

    public static double nextDouble() {
        return Double.parseDouble(next());
    }
}

import java.awt.Point;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Testing {

    FastScanner in;
    PrintWriter out;
    public void solve() throws IOException
    {
        int n = in.nextInt();
        int m = in.nextInt();
        int result = 0;

        if(n==m)
            out.println("infinity\n");
        else{
            n-=m;

            for(int i=1;i*i<=n;i++)
                if(n%i == 0)
                {
                    if (i > m)
                    {
                        if (i*i != n)
                            result++;
                        if (n/i > m)
                            result++;
                    }
                }
        }
        out.println(result);
    }

    public void run()
    {
        try
        {
            in  = new FastScanner();
            out = new PrintWriter(System.out);

            //in     = new FastScanner(new File("knapsack.in"));
            //out = new PrintWriter(new File("knapsack.out"));

            solve();

            out.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    class FastScanner
    {
        BufferedReader  br;
        StringTokenizer st;

        FastScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            }
            catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        String nextLine()
        {
            String ret = null;
            try
        {
                ret = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

            return ret;
        }

        String next()
        {
            while (st == null || !st.hasMoreTokens())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++)
            {
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++)
            {
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index)
            {
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);

                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new Testing().run();
    }
}

import java.util.Scanner;

public class Amazon {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNextInt()) {
			int a = sc.nextInt();
			int b = sc.nextInt();

			if (a == b) {
				System.out.println("infinity");
				continue;
			}

			if (a < b) {
				System.out.println(0);
				continue;
			}

			int c = a - b;
			int answer = 0;

			double fin = Math.sqrt(a);
			for (int i = 2; i <= fin; i++) {
				if (c % i == 0) {
					int d = c / i;

					if (i > b) {
						answer++;
					}

					if (i != d && d > b) {
						answer++;
					}
				}
			}

			if (a % c == b) {
				answer++;
			}

			System.out.println(answer);
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Random;
import java.util.StringTokenizer;

public class B {

  static BufferedReader in;
  static PrintWriter out;
  static StringTokenizer tok;

  static void solve() throws Exception {
    long a = nextLong();
    long b = nextLong();
    if (a < b)
      out.println(0);
    else if (a == b)
      out.println("infinity");
    else {
      long c = a - b;
      if (c == 1)
        out.println(0);
      else {
        long count = 1;
        for (long i = 2; i < Math.sqrt(c) + 1; i++)
          if (c % i == 0) {
            if (i > b)
              count++;
            if (c / i > b && i != c / i)
              count++;
          }
        out.println(count);
      }
    }
  }

  public static void main(String args[]) {
    try {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(new OutputStreamWriter(System.out));
      // in = new BufferedReader(new FileReader("input.in"));
      // out = new PrintWriter(new FileWriter("output.out"));
      solve();
      in.close();
      out.close();
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(1);
    }
  }

  static int nextInt() throws IOException {
    return Integer.parseInt(next());
  }

  static long nextLong() throws IOException {
    return Long.parseLong(next());
  }

  static double nextDouble() throws IOException {
    return Double.parseDouble(next());
  }

  static BigInteger nextBigInteger() throws IOException {
    return new BigInteger(next());
  }

  static String next() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      tok = new StringTokenizer(in.readLine());
    }
    return tok.nextToken();
  }

  static String nextLine() throws IOException {
    tok = new StringTokenizer("");
    return in.readLine();
  }

  static boolean hasNext() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      String s = in.readLine();
      if (s == null) {
        return false;
      }
      tok = new StringTokenizer(s);
    }
    return true;
  }

  static void shuffleArray(long[] array) {
    Random random = new Random();
    for (int i = array.length - 1; i > 0; i--) {
      int index = random.nextInt(i + 1);
      long temp = array[index];
      array[index] = array[i];
      array[i] = temp;
    }
  }

}

/**
 * Created by user on 12/15/2014.
 */
import java.util.
        *;
public class three
{
    public static int[] arr = new int[1000000];
    public static Set<Long> set = new HashSet<Long>();
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        long a = input.nextLong();
        long b = input.nextLong();
        if(b == 0){
            System.out.println(1); return ;}
        if(a > b)
        {
            int cnt = 0;
            long temp = a - b;
            set.add(new Long(temp));
            for(int i = 2; i < (int)Math.sqrt(temp)+ 20; i++)
            {
                if(temp % i == 0)
                {
                    set.add(new Long(i));
                    set.add(new Long(temp/i));
                }
            }
            Long[] khar = new Long[set.size()];
            set.toArray(khar);

            for(int i =0; i < khar.length; i++)
                if(khar[i] != 0 && khar[i] !=1 && a % khar[i] == b)
                    cnt ++;

            System.out.println(cnt);

        }
        else
        {
            if(a != 0 && a!= 1)
                System.out.println("infinity");
            else
            {
                if(a == 0 && b != 0)
                    System.out.println(0);
                else if(a == 1 && b != 1)
                    System.out.println(0);
                else if(a == 1 && b == 1)
                    System.out.println("infinity");

            }

        }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a < b) {
			System.out.println(0);
			return;
		} else if (a == b) {
			System.out.println("infinity");
			return;
		}
		int cnt = 0;
		int sub = a - b;
		for (int i = 1; i * i <= sub; i++) {
			if (sub % i == 0) {
				if (a % i == b) {
					cnt++;
				}
				if (a % (sub / i) == b) {
					cnt++;
				}
			}
		}
		System.out.println(cnt);
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(int[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}
}

import java.util.Scanner;

public class MainActivity {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();

        int x = 0;
        int y = 0;

        int xy = a - b;
        if (xy == 0)
            System.out.println("infinity");
        else {
            for (int i = 1, j = (int) Math.ceil(xy / 2); i <= (xy / 2); i++, j--) {
                if (i == j) {
                    if ((a % i) == b) x++;
                } else {
                    if ((a % i) == b) x++;
                    if ((a % j) == b) x++;
                }
            }

            /* for (int i = 1; i <= xy; i++) {
                if ((a % i) == b) y++;
            } */

            System.out.println(Math.round(x / 2) + 1);
        }
    }
}

import java.io.*;
import java.util.*;

public class b {
	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public void solve() throws IOException {
		int a = nextInt();
		int b = nextInt();
		int ans = 0;
		if (a < b) {
			out.print(0);
		} else {
			if (a == b) {
				out.print("infinity");
			} else {
				int c = a - b;
				for (int i = 2; i * i < c; i++) {
					if (a % i == b) {
						if (i > b) {
							ans++;
						}
					}
					if (a % (c / i) == b) {
						if (c / i > b) {
							ans++;
						}
					}
				}
				int q = (int) Math.sqrt(c);
				if (q * q == c) {
					if (q > b) {
						ans++;
					}
				}
				if (a % c == b) {
					if (c > b) {
						ans++;
					}
				}

				out.print(ans);

			}
		}
	}

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public void run() throws IOException {

		// br = new BufferedReader(new FileReader(new File("")));
		// out = new PrintWriter("");
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();

		br.close();
		out.close();

	}

	public static void main(String[] args) throws IOException {
		new b().run();

	}
}

import java.util.*;

public class problem282_2 {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int num=in.nextInt();
        int rem=in.nextInt();
        if(rem>num)
            System.out.println("0");
        else if(rem==num)
            System.out.println("infinity");
        else{
            int number=num-rem;
            ArrayList<Integer> factors=new ArrayList<Integer>();
            for(int i=1;i<(int)Math.sqrt(number);++i){
                if(number%i==0){
                    factors.add(i);
                    factors.add(number/i);
                }
            }
        int count=0;
        for(int e:factors){
            if(e>rem)
                ++count;
        }
        System.out.println(""+count);
        }
    }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public final class CF_Modular {

	void log(int[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}

	void log(long[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}
	void log(Object[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}

	void log(Object o){
		logWln(o+"\n");
	}

	void logWln(Object o){
		//System.out.print(o);
		outputWln(o);

	}
	void info(Object o){
		System.out.println(o);
		//output(o);
	}

	void output(Object o){

		outputWln(""+o+"\n");

	}

	void outputWln(Object o){
		// System.out.print(o);

		try {
			out.write(""+ o);
		} catch (Exception e) {

		}
	}

	String next(){
		while (st== null|| !st.hasMoreTokens()) {
			try {
				st=new StringTokenizer(in.readLine());
			} catch (Exception e) {
			}
		}
		return st.nextToken();
	}

	String nextLine(){
		try {
			return in.readLine();
		} catch (Exception e) {
		}
		return null;
	}

	int nextInt(){
		return Integer.parseInt(next());
	}

	long nextLong(){
		return Long.parseLong(next());

	}

	// Global vars
	StringTokenizer st;
	BufferedReader in;
	BufferedWriter out;

	void solve(int a,int b){

		ArrayList<Integer> divisors=new ArrayList<Integer>();
		ArrayList<Integer> coef=new ArrayList<Integer>();
		if (b>a){
			output("0");
			return;
		}
		if (a==b) {
			output("infinity");
			return;
		}
		int delta=a-b;
		for (int p=2;p*p<=delta;p++){
			if (delta%p==0){
				divisors.add(p);
				int cnt=0;

				while (delta%p==0){
					delta=delta/p;
					cnt++;
				}
					coef.add(cnt);
			}
			if (p*p>delta) {
				divisors.add(delta);
				coef.add(1);
				delta=1;
			}
		}
		int L=divisors.size();
		ArrayList<Integer> res=new ArrayList<Integer>();
		res.add(1);
		for (int i=0;i<L;i++){
			int M=res.size();
			int p=divisors.get(i);
				for (int j=0;j<M;j++){
					int x=res.get(j);
					int m=p;
					for (int u=0;u<coef.get(i);u++){
						res.add(x*m);
						m*=p;
					}
			}
		}

		int cnt=0;
		int M=res.size();
		for (int i=0;i<M;i++){
			int x=res.get(i);
			if (a%x==b)
				cnt++;
		}
		output(cnt);
	}

	void process() throws Exception {

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		in=new BufferedReader(new InputStreamReader(System.in));

		int a=nextInt();
		int b=nextInt();
		solve(a,b);

		try {
			out.close();
		}
		catch (Exception e){}

	}

	public static void main(String[] args) throws Exception {
		CF_Modular J=new CF_Modular();

		J.process();

	}

}

import java.util.*;

public class r495b {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		n = n - k;
		if (n<0) {
			System.out.println(0);
		} else if (n==0) {
			System.out.println("infinity");
		} else {
			// n>0
			int count = 0;
			for (int i = 1; i<=Math.sqrt(n); i++) {
				if (n%i==0) {
					if (i<k ||  i==Math.sqrt(n)) {
						count += 1;
					} else {
						count += 2;
					}
				}
			}
			System.out.println(count);
		}
	}
}

import java.util.Scanner;
public class Mod {

public static Scanner  in= new Scanner (System.in);

    public static void main(String[] args) {
        int a = in.nextInt();
        int b = in.nextInt();
        int c=0,k=2,d=a-b,s=0;
      // 772930485 686893955
 if(b==a)
            System.out.println("infinity");
     else
 {
     if((b*2>a))
      {}
      else
      {   int f;

          for (f = a ; f>0;f--)
           {
            if(a%f==5){c++; break;}
           }

           for (int i = f/2 ; i>0;)
        {
            if(a%i==5)
            {
             c++;
                System.out.println(i);
            }
            if(k<10)
            {
                k++;
                String as=""+i;
                if(as.length()>3)
                i=f/k;
                else
                    i--;
            }
            else
                i--;
        }
}
      System.out.println((int)c);
}}}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class  Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here

         BufferedReader inp=new BufferedReader(new InputStreamReader(System.in));
         String s[]=inp.readLine().split(" ");
         int a=Integer.parseInt(s[0]);
         int b=Integer.parseInt(s[1]);

         if(a<b)
          System.out.println(0);
        else if(a==b)
          System.out.println("infinity");
          else
           {

             int count=0;
             for(int i=2;i*i<=a-b;i++)
                 {
                    if((a-b)%i==0)
                       {
                            if(i>b)
                              count++;
                            if(((a-b)/i)>b && (i*i!=a-b))
                              count++;
                         }
                  }
                     if(b==0)
                     count=count+1;
             System.out.println(count+1);
           }
    }
}

import java.io.*;
import java.util.*;

public class CF495B {
	public static void main(String[] args) throws IOException {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(bf.readLine());
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		if (A == B){
			System.out.println("INFINTY");
		}
		if (A < B){
			System.out.println(0);
		}
		else{
			int ans=0;
			int base=A-B;
			for(int i=1;i*i<=base;i++){
				if(A % i == B){
					ans++;
				}
				if(A % (base/i) == B && i != (base/i)){
					ans++;
				}
			}
			System.out.println(ans);
		}
	}
}

/**
 * Created by user on 12/15/2014.
 */
import java.util.
        *;
public class three
{
    public static int[] arr = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        long a = input.nextLong();
        long b = input.nextLong();
        if(a > b)
        {
            int cnt = 0;
            long temp = a - b;
            for(int i = 2; i < (int)Math.sqrt(temp)+ 20; i++)
            {
                if(temp % i == 0)
                {
                    if(a%i == b)
                        cnt ++;
                    if(a % (temp/i) == b)
                        cnt ++;
                }
            }
            if(a % temp == b)
                cnt ++;
            System.out.println(cnt);

        }
        else
        {
            System.out.println("infinity");
        }
    }
}

import java.io.*;
import java.lang.Math;
import java.util.*;

public class Main
{
	public BufferedReader in;
	public PrintStream out;

	public boolean log_enabled = true;

	public void test()
	{
		int a = readInt(), b= readInt();
		if (a==b)
		{
			out.println("infinity");
			return;
		}
		if (a<b)
		{
			out.println(0);
			return;
		}

		int n = a-b;
		int r = 1;
		for (int i=2; i*i<=n; i++)
		{
			if (n % i == 0)
			{
				if (i>b)
				{
					r++;
				}

				if ((i*i<n) && (n>b*i)) r++;
			}
		}

		out.println(r);
	}

	public void run()
	{
		try
		{
			in = new BufferedReader(new InputStreamReader(System.in));
			out = System.out;

			//in = new BufferedReader(new FileReader("in.txt"));
			//out = new PrintStream(new File("out.txt"));

		}
		catch (Exception e)
		{
			return;
		}

		//while (true)
		{
			//int t = readInt(); for (int i=0; i<t; i++)
			{
				test();
			}
		}
	}

	public static void main(String args[])
	{
		new Main().run();
	}

	private StringTokenizer tokenizer = null;

	public int readInt()
	{
        return Integer.parseInt(readToken());
    }

    public long readLong()
	{
        return Long.parseLong(readToken());
    }

    public double readDouble()
	{
        return Double.parseDouble(readToken());
    }

	public String readLn()
	{
		try
		{
			String s;
			while ((s = in.readLine()).length()==0);
			return s;
		}
		catch (Exception e)
		{
			return "";
		}
	}

    public String readToken()
	{
		try
		{
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				tokenizer = new StringTokenizer(in.readLine());
			}
			return tokenizer.nextToken();
		}
		catch (Exception e)
		{
			return "";
		}
    }

	public int[] readIntArray(int n)
	{
		int[] x = new int[n];
		readIntArray(x, n);
		return x;
	}

	public void readIntArray(int[] x, int n)
	{
		for (int i=0; i<n; i++)
		{
			x[i] = readInt();
		}
	}

	public void logWrite(String format, Object... args)
	{
		if (!log_enabled)
		{
			return;
		}

		out.printf(format, args);
	}
}

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int count = 0;
        if(a==0 && b!=0)
            System.out.println("0");
        else if(a>b){
            for (int i = 1; i <= Math.sqrt(a-b); i++) {
                if((a-b)%i==0 && i!=(a-b)/i){
                    if(a%i==b)
                        count++;
                    if(a%((a-b)/i)==b)
                        count++;
                }
                else if((a-b)%i==0)
                    if(a%i==b)
                        count++;
            }
            System.out.println(count);
        }
        else{
            System.out.println("infinity");
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

//  public static void main(String[] args) throws IOException {
//      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//      String line = br.readLine();
//      int[] A = new int[line.length()];
//      if (line.charAt(0) != '(') {
//          System.out.println(-1);
//          return;
//      }
//      A[0] = 1;
//      for (int i = 1; i < line.length(); i++) {
//          int k = (line.charAt(i) == '(') ? 1 : -1;
//          A[i] = A[i-1] + k;
//          if (A[i] < 0) {
//              System.out.println(-1);
//              return;
//          }
//      }
//      int last = line.length()-1;
//      while (line.charAt(last) != '#') {
//          last--;
//      }
//
//      if (A[line.length()-1] > A[last]) {
//          System.out.print(-1);
//          return;
//      }
//      int lastVal = 1 + A[line.length()-1];
//      for (int i = last+1; i < line.length(); i++) {
//          if (A[i] - lastVal + 1 < 0) {
//              System.out.println(-1);
//              return;
//          }
//      }
//      for (int i = 0; i < last; i++) {
//          if (line.charAt(i) == '#') {
//              System.out.println(1);
//          }
//      }
//      System.out.println(lastVal);
//  }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String[] values = line.split(" ");
        int a = Integer.parseInt(values[0]);
        int b = Integer.parseInt(values[1]);
        int c = a - b;
        if (c == 0) {
            System.out.println("infinity");
            return;
        }
        int counter = 0;
        for (int i = 1; i <= Math.sqrt(c); i++) {
            if (c % i == 0) {
                if (i > b) {
                    counter++;
                }
                if (c / i > b) {
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
}

import java.util.Scanner;

public class DigitalCounter{
  public static void main( String args[] ){
    int x;
    int y;
    int z;
    int count;

    Scanner scan = new Scanner( System.in );
    x = scan.nextInt();
    y = x / 10;
    z = x - 10 * y ;
    count = 1;

    if( y == 1 ){
    count = count * 7;
    }
    else if( y == 2 ){
      count = count * 2;
    }

    else if( y == 3 ){
      count = count * 3;
    }

    else if( y == 4 ){
      count = count * 3;
    }

    else if( y == 5 ){
      count = count * 4;
    }

    else if( y == 6 ){
      count = count * 2;
    }

    else if( y == 7 ){
      count = count * 5;
    }

    else if( y == 8 ){
      count = count * 1;
    }

    else if( y == 9 ){
      count = count * 2;
    }

    else if( y == 0 ){
      count = count * 2;
    }

    if( z == 1 ){
      count = count * 7;
    }
    else if( z == 2 ){
      count = count * 2;
    }

    else if( z == 3 ){
      count = count * 3;
    }

    else if( z == 4 ){
      count = count * 3;
    }

    else if( z == 5 ){
      count = count * 4;
    }

    else if( z == 6 ){
      count = count * 2;
    }

    else if( z == 7 ){
      count = count * 5;
    }

    else if( z == 8 ){
      count = count * 1;
    }

    else if( z == 9 ){
      count = count * 2;
    }

    else if( z == 0 ){
      count = count * 2;
    }

    System.out.println( count );

  }
}

import java.util.Scanner;
public class main
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        float x = a-b;
        float temp = x;
        int count = 1;
        int i = 2;
        if(x == 0)
        {
            System.out.println("infinity");
            System.exit(0);
        }
        while(i <= Math.sqrt(a-b))
        {
            if(a%i == b)
            {
                count += 1;
            }
            if(a%((a-b)/i) == b && i!=((a-b)/i))
            {
                count += 1;
            }
            i++;
        }
        System.out.println(count);
    }
}

import java.io.*;
import java.util.*;

public class B {
    void solve() throws IOException {
        long a = nextLong(), b = nextLong();

        if (a > b) {
            long counter = 0;

            long c = a - b;
            long l = 1, u = c / l + 1;
            while (l <= u) {
                if (c % l == 0) {
                    if (l >= b + 1) {
                        counter++;
                    }
                    if (c / l >= b + 1) {
                        counter++;
                    }
                }

                l++;
                u = c / l + 1;
            }

            out.println(counter);
        } else {
            out.println("infinity");
        }
    }

    void run() throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        // reader = new BufferedReader(new FileReader("file.in"));
        // out = new PrintWriter(new FileWriter("file.out"));
        tokenizer = null;
        solve();
        reader.close();
        out.flush();
    }

    public static void main(String[] args) throws IOException {
        new B().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}

// package Div2;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

public class Sketch {
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		input.close();

		if(a < b){
			System.out.println(0);
			return;
		}
		if(a == b){
			System.out.println("infinity");
			return;
		}

		int gap = a-b;
		int count = 0;
		int sqrt = (int) Math.sqrt(gap);
		for(int i=1; i<sqrt; i++){
			if(gap % i == 0){
				count++;
			}
		}
		count = count << 1;
		if(gap % sqrt == 0)
			count ++;

		if(b <= sqrt){
			for(int i=1; i<=b; i++){
				if(gap % i==0)
					count--;
			}
		}
		else {
			if(gap % sqrt == 0)
				count--;
			for(int i=1; i<gap/b; i++){
				if(gap % i==0)
					count--;
			}
			int cnt = 0;
			for(int i=Math.max(gap/b, 1); i<sqrt; i++){
				if(gap % i==0)
					cnt++;
			}
			count -= cnt << 1;
		}

		System.out.println(count);
	}
}

import java.util.Scanner;
public class Mod {

public static Scanner  in= new Scanner (System.in);

    public static void main(String[] args) {
        int a = in.nextInt();
        int b = in.nextInt();
        int c=0,k=0,d=a-b;
      // for (int i = 1 ; i<a;i++)
        if(b>=a)
            System.out.println("infinity");
        else
        {
           for (int i = a ; i>0;)
        {
            k++;
            if(a>10000000)
            {
            if(k<20)
            {
                if (a%i==b)
                {
                c++;
                i=d/k;

                }
            }
            else
            {
            if (a%i==b)
            {

                c++;
            }
             i--;
            }

        }

            else
            {
            if (a%i==b)
            {

                c++;
            }
             i--;
            }

    }
             System.out.println(c);
}
}}

import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long ost = a - b;
        long n = 0;
        if (a < b && a != 0) {
            System.out.println("0");
            return;
        }
        if (a == b) {
            System.out.println("infinity");
            return;
        }
        if (a < b && a == 0) {
            System.out.println("0");
            return;
        }
        for (long i = b + 1; i <= ost/2; i++) {
            if (ost % i == 0)
                n++;
        }
        System.out.println(n);
    }

}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author minhthai
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskB {
    int A, B;
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        A = in.nextInt(); B = in.nextInt();
        int C = A - B;
        if(C == 0) {
            out.println("infinity");
            return;
        }
        int count = 0, limit = (int)Math.sqrt(C);
        for(int i = B; i <= limit; ++i) {
            if(C % i == 0 )
                count+= 2;
        }

        for(int i = A / B ; i < A; ++i) {
            if(C % i == 0 && i > B)
                count+= 1;
        }

        out.println(count);
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.*;

public class problem282_2 {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int num=in.nextInt();
        int rem=in.nextInt();
        if(rem>num)
            System.out.println("0");
        else if(rem==num)
            System.out.println("infinity");
        else{
            int number=num-rem;
            ArrayList<Integer> factors=new ArrayList<Integer>();
            for(int i=1;i<(int)Math.sqrt(number);++i){
                if(number%i==0){
                    factors.add(i);
                    factors.add(number/i);
                }
            }
        int count=0;
        for(int e:factors){
            if(e>rem)
                ++count;
        }
        System.out.println(""+count);
        }
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] e = br.readLine().split(" ");
		long a = Integer.parseInt(e[0]);
		long b = Integer.parseInt(e[1]);

		if(a>b)
		{
			long counter = 0;
			for(long i = 1; i<=a; i++)
			{
				if(a%i==b)
				 counter++;
			}
			System.out.println(counter);
		}
		else if(a==b && a!=0)
			System.out.println("infinity");
		else
			System.out.println(0);
	}
}

import java.util.Scanner;
public class Mod {

public static Scanner  in= new Scanner (System.in);

    public static void main(String[] args) {
        int a = in.nextInt();
        int b = in.nextInt();
        int c=0,k=2,d=a-b,s=0;
      // 772930485 686893955
 if(b==a)
            System.out.println("infinity");
     else
 {
     if((b*2>a))
      {}
      else
      {   int f;

          for (f = a ; f>0;f--)
           {
            if(a%f==5){c++; break;}
           }

           for (int i = f/2 ; i>0;)
        {
            if(a%i==5)
            {
             c++;
            }
            if(k<10)
            {
                k++;
                String as=""+i;
                if(as.length()>3)
                i=f/k;
                else
                    i--;
            }
            else
                i--;
        }
}
      System.out.println((int)c);
}}}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Walker
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        int diff = a - b;
        if(a == b){
            out.print("infinity");
            return;
        }
        int count = 0;
        int upper = ((int) Math.sqrt(diff)) + 1;
        for(int i = 1; i <= upper; i++){
            if(a % i == b){
                count++;
            }
            int j = diff / i;
            if(a % j == b){
                count++;
            }
        }
        out.print(count);
    }
}

import java.util.Scanner;

public class hello60 {
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int target = a-b;
		int num = 0;
		for(int i = target ; i >= 1 ; i--){
			if(target % i ==0 && i > b ) num++;
			if(i <= b) break;
		}
		System.out.println(num);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
 *
10%1=1
10%11 = 10

21%8 = 5
21%16 = 5

21%8 = 5
21%16 = 5

21%6 = 3
21%9 = 3
21%18 = 3

24 3
24%21 = 3
24%7 = 3

33 1

43 i*i = i->6

43%2 = 1
43%3 = 1
43%6 = 1
43%7 = 1
43%12 = 1
43%21 = 1
43%42 = 1

**/

public class B_Div2_282 {
    public static void main(String[]arg) throws IOException
    {
       BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
       StringTokenizer st = new StringTokenizer(in.readLine());

       long a = Long.parseLong(st.nextToken());
       long b = Long.parseLong(st.nextToken());
       if(a == b)
           System.out.println("infinity");
       else if(b > a)
       {
           System.out.println(0);
       }
       else
       {
           long rest = a - b;
           int ans = 0;
           for(long i = 1; i*i <= rest; i++)
           {
               if(rest%i == 0)
               {
                   if(a%i == b)
                       ans++;
                   if(a%(rest/i) == b )
                       ans++;
               }
           }
           System.out.println(ans);
       }
    }
}

import java.awt.Point;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Testing {

    FastScanner in;
    PrintWriter out;
    public void solve() throws IOException
    {
        int n = in.nextInt();
        int m = in.nextInt();
        int result = 0;

        if(n==m)
            out.println("infinity");
        else{
            n-=m;

            for(int i=1;i*i<=n;i++)
                if(n%i == 0)
                {
                    if (i > m)
                    {
                        if (i*i != n)
                            result++;
                        if (n/i > m)
                            result++;
                    }
                }
            out.println(result);
        }
    }

    public void run()
    {
        try
        {
            in  = new FastScanner();
            out = new PrintWriter(System.out);

            //in     = new FastScanner(new File("knapsack.in"));
            //out = new PrintWriter(new File("knapsack.out"));

            solve();

            out.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    class FastScanner
    {
        BufferedReader  br;
        StringTokenizer st;

        FastScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            }
            catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        String nextLine()
        {
            String ret = null;
            try
        {
                ret = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

            return ret;
        }

        String next()
        {
            while (st == null || !st.hasMoreTokens())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++)
            {
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++)
            {
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index)
            {
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);

                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new Testing().run();
    }
}

import java.io.*;
import java.util.*;

public class ModEqn
{
    public static void main (String [] args) throws IOException {

      Scanner sc = new Scanner(System.in);

      PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

      Long a = sc.nextLong();
      Long b = sc.nextLong();

      if (b > a) {
          out.println(0);
      } else if (b == a) {
          out.println("infinity");
      } else if (b == 0) {
          int div = 1;
          for (long y = 2; y < a+1; y++) {
              if (a%y == 0) {
                  div++;
              }
          }
          out.println(div);
      } else {
          int div = 0;
          int sub = 0;
          for (long x = 1; x < (int) Math.floor(Math.sqrt(b-a)+1); x++) {
              if ((a-b)%x == 0) {
                  div++;
                  if (x < b) {
                      sub++;
                  }
              }
          }
          out.println(2*div-sub);
      }

      out.close();
      System.exit(0);
  }
}

import java.io.*;
import java.util.*;

public class ProblemB
{

    private void run() throws IOException
    {
        // put your code here :)
        int a = nextInt();
        int b = nextInt();

        int diff = a-b;
        if(diff == 0){
            System.out.println("infinity");
            return;
        }

        int count = 1;
        for (int i = 2; i <= diff; i++) {
            if(diff%i == 0){
                int x = diff/i;
                if(a%x == b)
                    count ++;
//              else if(a%x > b)
//                  break;
            }
        }

        System.out.println(count);
    }

    private int nextInt() throws IOException {
            if (input.hasMoreTokens())
                    return Integer.parseInt(input.nextToken());
            input = new StringTokenizer(in.readLine());
            return nextInt();

    }

    private void end() throws IOException {
            in.close();
            out.flush();
            out.close();
            System.exit(0);
    }

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer input;

    public ProblemB() throws IOException {
            // Input Output for Console to be used for trying the test samples of
            // the problem
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            // -------------------------------------------------------------------------
            // Input Output for File to be used for solving the small and large
            // test files
    //      in = new BufferedReader(new FileReader("UVA.in"));
    //      out = new PrintWriter("UVA.out");
            // -------------------------------------------------------------------------
            // Initalize Stringtokenizer input
            input = new StringTokenizer("");
    }

    public static void main(String[] args) throws Exception {
            // -------------------------------------------------------------------------
            // initializing...
        ProblemB sol = new ProblemB();
            // -------------------------------------------------------------------------
            sol.run();
            // -------------------------------------------------------------------------
            // closing up
            sol.end();
            // --------------------------------------------------------------------------
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
	static final long MODULO = (int) (1e9 + 7);

	public void solve(int testNumber, InputReader in, PrintWriter out) {

		int a = in.nextInt();
		int b = in.nextInt();
		if (b >= a) {
			System.out.println("infinity");
		}else{
			int sum = 0;
			int par = a-b;
			//int count = (a - b)/2;
			for (int i = b; i <= par; i++){
				if (a%i == b){
					sum++;
					//System.out.println(i);
				}
			}
			System.out.println(sum);
		}

	}
}

class Path implements Comparable<Path> {
	public int v;
	int num;
	int w;
	int a1;
	int a2;

	public Path(int a, int a1, int a2, int w, ArrayList<Pair> p) {
		num = a;
		this.w = w;
		this.a1 = a1;
		this.a2 = a2;
		p.get(a1 - 1).add(this);
		p.get(a2 - 1).add(this);

	}

	@Override
	public int compareTo(Path arg0) {
		// TODO Auto-generated method stub
		return this.v - arg0.v;
	}

}

class Pair implements Comparable<Pair> {
	public int v;
	int num;
	ArrayList<Path> pp;

	public Pair(int a) {
		num = a;
		pp = new ArrayList<Path>();
	}

	public void add(Path path) {
		pp.add(path);
	}

	@Override
	public int compareTo(Pair arg0) {
		// TODO Auto-generated method stub
		return this.v - arg0.v;
	}

}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public final class CF_Modular {

	void log(int[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}

	void log(long[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}
	void log(Object[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}

	void log(Object o){
		logWln(o+"\n");
	}

	void logWln(Object o){
		//System.out.print(o);
		outputWln(o);

	}
	void info(Object o){
		System.out.println(o);
		//output(o);
	}

	void output(Object o){

		outputWln(""+o+"\n");

	}

	void outputWln(Object o){
		// System.out.print(o);

		try {
			out.write(""+ o);
		} catch (Exception e) {

		}
	}

	String next(){
		while (st== null|| !st.hasMoreTokens()) {
			try {
				st=new StringTokenizer(in.readLine());
			} catch (Exception e) {
			}
		}
		return st.nextToken();
	}

	String nextLine(){
		try {
			return in.readLine();
		} catch (Exception e) {
		}
		return null;
	}

	int nextInt(){
		return Integer.parseInt(next());
	}

	long nextLong(){
		return Long.parseLong(next());

	}

	// Global vars
	StringTokenizer st;
	BufferedReader in;
	BufferedWriter out;

	void solve(int a,int b){

		ArrayList<Integer> divisors=new ArrayList<Integer>();
		ArrayList<Integer> coef=new ArrayList<Integer>();
		if (b>a){
			output("0");
			return;
		}
		if (a==b) {
			output("infinity");
			return;
		}
		int cnt=0;
		int delta=a-b;
		for (int i=2;i*i<=delta;i++){
			if (delta % i==0){
				if (i>b)
					cnt++;
				if (delta/i>b && delta/i!=i)
					cnt++;
			}
		}
		output(cnt);
	}

	void process() throws Exception {

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		in=new BufferedReader(new InputStreamReader(System.in));

		int a=nextInt();
		int b=nextInt();
		solve(a,b);

		try {
			out.close();
		}
		catch (Exception e){}

	}

	public static void main(String[] args) throws Exception {
		CF_Modular J=new CF_Modular();

		J.process();

	}

}

import java.util.*;
import java.lang.*;
import java.io.*;

public class R282A  {

    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int a = in.nextInt(), b = in.nextInt(), ans = 0;
        if (a == b) {
            w.println("infinity");
        } else {
            for (int i = b + 1; i < a; i++) {
                if (a % i == b)
                    ans++;
            }
            w.println(ans);
        }
        w.close();
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class  Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here

         BufferedReader inp=new BufferedReader(new InputStreamReader(System.in));
         String s[]=inp.readLine().split(" ");
         int a=Integer.parseInt(s[0]);
         int b=Integer.parseInt(s[1]);

         if(a<b)
          System.out.println(0);
        else if(a==b)
          System.out.println("infinity");
          else
           {

             int count=0;
             for(int i=2;i*i<=a-b;i++)
                 {
                    if((a-b)%i==0)
                       {
                            if(i>b)
                              count++;
                            if(((a-b)/i)>b && (i*i!=a-b))
                              count++;
                         }
                  }
                     if(b==0 && a==1)
                  {
                     count=count+1;
                     System.out.println(count);
return;
}
             else if(b==0 && a!=1)
               System.out.println(count+2);
else if(count>0)
System.out.println(count+1);
else if(count==0)
        System.out.println(count);
           }
    }
}

import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long ost = a - b;
        long n = 0;
        if (a < b && a != 0) {
            System.out.println("1");
            return;
        }
        if (a == b && a!=0) {
            System.out.println("infinity");
            return;
        }
        if ((a < b && a == 0) || (a==0 && b==0)) {
            System.out.println("0");
            return;
        }
        for (long i = b + 1; i <= ost; i++) {
            if (ost % i == 0)
                n++;
        }
        System.out.println(n);
    }

}

import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ost = a - b;
        int n = 0;
        if (a<b) {
            System.out.println("1");
            return;
        }
        if (a==b && b==0) {
            System.out.println("0");
            return;
        }
        if (a==b) {
            System.out.println("infinity");
            return;
        }
        for (int i = b + 1; i <= ost; i++) {
            if (ost % i == 0)
                n++;
        }
        System.out.println(n);
    }

}

import java.util.Scanner;

public class Main {
    public static void main(String[] args)
    {
      Scanner in = new Scanner (System.in);
      int a ,b,s=0;
a=in.nextInt();
b=in.nextInt();

      for(int i=1;i<=a;i++)
    {
       if(a%i==b)
           s++;
       if(a==b)
       {
            System.out.println("infinity");
    break;
       }
    }
    System.out.println(s);
    }
}

import java.util.Scanner;

public class FOURNINEFIVEB31{

    public static void main(String[] args){

        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();
        int count = 0;
        int x = b;

        if(a==b)
        {
            System.out.println("infinity");
            in.close();
        return;
        }
        while(x < a)
        {
            x++;
            if(a%x==b){
                x+=b;

                count++;
            }
        }
        System.out.println(count);
        in.close();
    }
}

import java.util.Scanner;

public class B{
	public static void main(String[] args) {
		Scanner in =  new Scanner(System.in);

		long a = in.nextLong();
		long b = in.nextLong();

		int count = 0;

		long n = a - b;

		if (n == 0){
			System.out.println("infinity");
			return;
		}

		long start = System.nanoTime();

		System.out.println(n);
		loop: for (long i = 1; i < n + 1; i++){

			// if (n%i == 0 && n/i > b)
			// 	count++;

			if (n%i == 0){
				if ( n/i > b){
					count++;
					// System.out.println("N: " + n + "    i: " + i);
				} else{
					break loop;
				}
			}
		}

		System.out.println(count);
		// System.out.println(  ((double) System.nanoTime() - start) / 1000000000.0);
	}
}

import java.util.Scanner;

/**
 * Created by huangyi on 14-12-15.
 */
public class Main {
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
            int a=s.nextInt();
            int b=s.nextInt();
            int result;
            if(a<b){
                System.out.println(0);
            }else if(a==b){
                System.out.println("infinity");
            }else{
              int x=a-b;
               result=0;
              for(int i=1;i<=Math.sqrt(x);i++){

                  if(x%i==0) {
                      if(i<=b){
                          if(x/i>b){
                              result++;
                          }

                      }else{
                          result=result+2;
                      }
                      if(i*i==x){
                        result--;
                      }

                }
              }
              System.out.println(result);
            }

    }
}

//package contest_13_12_20114;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class B {
public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 int a=sc.nextInt();
	 int b=sc.nextInt();
	 int x=0;
	 int cnt=0;
	 if(a<=b){
		 System.out.println("infinity");
	 }else{
		 a=a-b;
		 int d=(int)Math.sqrt(a);
		Set<Integer>st=new TreeSet<Integer>();
		 for (int i =1; i<=d; i++) {
			if(a%i==0){st.add(i);st.add(a/i);
			}
		}
		 for(Integer i:st){
			 if(i>b){cnt++;}
		 }
		 System.out.println(cnt==0?"infinity":cnt);
	 }
}
}

import java.io.*;
import java.util.*;
public class weather
{
    public static void main(String []args)throws IOException
    {
        Scanner sc = new Scanner(System.in);
        long a,b;
        a = sc.nextLong();
        b = sc.nextLong();
        long val = a-b;
        if(val <= 0)
        {
            System.out.println("infinity");
            System.exit(0);
        }
        //System.out.println(val);
        long count = 0;
        for(long i=1;i<=Math.sqrt(val);i++)
        {
            if(val%i == 0 && i > b)
                count++;
            if(val%(val/i) == 0 && (val/i) != i && (val/i) > b)
                count++;
        }

        System.out.println(count);
    }
}

import java.util.*;

public class b
{
	public static void main(String[] arg)
	{
		Scanner in = new Scanner(System.in);
		long a = in.nextLong();
		long b = in.nextLong();
		long answer = 0;
		boolean flag = false;
		for(long i = 1; i <= 2*a; i++)
		{
			if(a%i == b)
			{
				answer++;
				if(i > a)
				{
					flag = true;
					break;
				}
				//System.out.println(i);
			}

		}
		//if(answer == 0)
		//	System.out.println("infinity");
		if(flag)
			System.out.println("infinity");
		else
			System.out.println(answer);
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            if (a < b) out.println(0);
            else if (a == b) out.println("infinity");
            else {
                int d = a - b;
                int dsq = (int) Math.sqrt(d);
                int ans = 1;
                for (int i = 2; i <= dsq; i++) {
                    if (d % i == 0) {
                        if (i > b) ans++;
                        if (d / i > b && d / i != i) ans++;
                    }
                }
                out.println(ans);
            }
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args)
    {
      Scanner in = new Scanner (System.in);
      int a ,b,s=0;
a=in.nextInt();
b=in.nextInt();

      for(int i=1;i<=a;i++)
    {
        if(a==b)
       {
            System.out.println("infinity");break;
       }
else
       if(a%i==b)
           s++;
    }
      if(a!=b)
    System.out.println(s);
    }
}

import java.util.Scanner;
public class Math1 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a= sc.nextInt();
		int b= sc.nextInt();
		int Q=a-b;
		int sum=0;
		if(b==0){
			System.out.println(1);
		}else{
		if(Q==0){
			System.out.println("infinity");
	}else{

		while(b<=Q){
			if(Q%b==0){
				sum=sum+1;
			}
			b=b+1;
		}
		System.out.println(sum);

	}
}

}
	}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {

    FastScanner in;
    PrintWriter out;

    static class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException {
            if (st == null || !st.hasMoreTokens())
                return br.readLine();
            StringBuilder result = new StringBuilder(st.nextToken());
            while (st.hasMoreTokens()) {
                result.append(" ");
                result.append(st.nextToken());
            }
            return result.toString();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

    }

    void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out, false);
        solve();
        out.close();
    }

    public static void main(String[] args) throws IOException{
        new Main().run();
    }

    public void printArr(int[] arr){
        for(int i = 0; i < arr.length; i++){
            out.print(arr[i] + " ");
        }
        out.println();
    }

    public long gcd(long a, long b){
        if(a == 0) return b;
        return gcd(b % a, a);
    }

    public void solve() throws IOException{

        int a = in.nextInt(), b = in.nextInt();

        if(a < b){
            out.println(0);
            return;
        }else if(a == b){
            out.println("infinity");
            return;
        }else if(b == 0){
            out.println("1");
            return;
        }else{

            long diff = a - b;
            int res = 0;

            for(long i = b; i <= diff; i++){
                if(diff % i == 0 && (i >b )) res++;
            }

            out.println(res);

        }

    }

}

import java.io.*;
import java.util.*;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class fast{

static class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int length = readInt();
        if (length < 0)
            return null;
        byte[] bytes = new byte[length];
        for (int i = 0; i < length; i++)
            bytes[i] = (byte) read();
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return new String(bytes);
        }
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuffer buf = new StringBuffer();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r')
                buf.appendCodePoint(c);
            c = read();
        }
        return buf.toString();
    }

    public String readLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines)
            return readLine();
        else
            return readLine0();
    }

    public BigInteger readBigInteger() {
        try {
            return new BigInteger(readString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return readString();
    }

    public boolean readBoolean() {
        return readInt() == 1;
    }
}
static int b;
static int divisor(int x){
        if(x==1)
            return 1;
	    int limit = x;
	    int numberOfDivisors = 0;

	    for (int i=1; i < limit; ++i) {
	        if (x % i == 0) {
	            limit = x / i;
	            if (limit != i) {
	                numberOfDivisors++;
	            }
                    if(i>b)
	            numberOfDivisors++;
	        }
	    }
	    return numberOfDivisors;
    }

            public static void main (String[] args) throws Exception{
            InputReader s = new InputReader(System.in);
            PrintWriter ww = new PrintWriter(System.out,true);
            int a=s.readInt();
            b=s.readInt();
            int rem=a-b;
        //    System.out.println(divisor(a));
            if(a==0&&b==0)
                ww.println("infinity");
            else if(rem<0)
                ww.println("infinity");
            else if((rem<=0)&&(a==0))
                ww.println("0");

            else{
                if(b==0){
                    ww.println(divisor(a));
                }
                else{
                int ans=divisor(rem);

                ww.println(ans);
                }
            }
            ww.close();
       }
}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.lang.*;

public class TaskB implements Runnable {
    boolean prime[] = new boolean[100001];
    void sieveOfEratosthenes(int n) {
        for (int i = 0; i < n; i++)
            prime[i] = true;
        for (int p = 2; p * p <= n; p++) {
            if (prime[p] == true) {
                for (int i = p * p; i <= n; i += p)
                    prime[i] = false;
            }
        }
    }
    public void run() {
        InputReader c = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n=c.nextInt();
        int m=c.nextInt();
        if(m==n){
            System.out.println("infinity");
            return;
        }
        int ht=n-m;
        if(ht<0) {
            System.out.println(0);
            return;
        }
        int cnt=0;
        for(int i=1;i<(int)Math.sqrt(ht);i++){
            if(ht%i==0){
                if(n%i==m)
                    cnt++;
                if(n%(ht/i)==m)
                    cnt++;
            }
        }
        int ab=(int)Math.sqrt(ht);
        if(ht%ab==0){
            if(n%ab==m)
                cnt++;
        }
        System.out.println(cnt);
        w.close();
    }
    class pair{
        int x,c;
        public pair(int a,int b){
            x=a;c=b;
        }
    }
    public static void sortbyColumn(int arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<int[]>()
        {
            public int compare(int[] o1, int[] o2){
                return(Integer.valueOf(o1[col]).compareTo(o2[col]));
            }
        });

    }
    class Graph{
        private final int v;
        private List<List<Integer>> adj;
        Graph(int v){
            this.v = v;
            adj = new ArrayList<>(v);
            for(int i=0;i<v;i++){
                adj.add(new LinkedList<>());
            }
        }
        private void addEdge(int a,int b){
            adj.get(a).add(b);
        }
        private boolean isCyclic()
        {
            boolean[] visited = new boolean[v];
            boolean[] recStack = new boolean[v];
            for (int i = 0; i < v; i++)
                if (isCyclicUtil(i, visited, recStack))
                    return true;

            return false;
        }
        private boolean isCyclicUtil(int i, boolean[] visited, boolean[] recStack)
        {
            if (recStack[i])
                return true;
            if (visited[i])
                return false;
            visited[i] = true;
            recStack[i] = true;
            List<Integer> children = adj.get(i);
            for (Integer c: children)
                if (isCyclicUtil(c, visited, recStack))
                    return true;
            recStack[i] = false;
            return false;
        }
    }
    static long gcd(long a, long b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    public static class DJSet {
        public int[] upper;

        public DJSet(int n) {
            upper = new int[n];
            Arrays.fill(upper, -1);
        }

        public int root(int x) {
            return upper[x] < 0 ? x : (upper[x] = root(upper[x]));
        }

        public boolean equiv(int x, int y) {
            return root(x) == root(y);
        }

        public boolean union(int x, int y) {
            x = root(x);
            y = root(y);
            if (x != y) {
                if (upper[y] < upper[x]) {
                    int d = x;
                    x = y;
                    y = d;
                }
                upper[x] += upper[y];
                upper[y] = x;
            }
            return x == y;
        }
    }
    public static int[] radixSort(int[] f)
    {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        {
            int[] b = new int[65537];
            for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
            for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
            for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
            int[] d = f; f = to;to = d;
        }
        return f;
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new TaskB(),"TaskB",1<<26).start();
    }
}

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		long a = scan.nextLong();
		long b = scan.nextLong();

		long c = a - b;

		if (c != 0) {
			long number = 0;
			long i;
			long j = c;
			for (i = 1; i < j; i++) {
				if (c % i == 0) {
					if (i > b && a % i == b) {
						number++;
					}
					j = c / i;
					if (i != j && j > b && a % j == b) {
						number++;
					}
				}
				if (isAval(j))
					break;
			}
			System.out.println(number);
		} else {
			System.out.println("infinity");
		}
	}

	public static boolean isAval(long x) {
		for (int i = 2; i <= Math.sqrt(x); i++) {
			if (x % i == 0)
				return false;
		}
		return true;
	}

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class B {

    private String ans(int a, int b) {
        if (a == b) return "infinity";
        else if (a < b) return "0";
        Set<Integer> nums = new HashSet<>();
        for (int i = 1; i*i < a-b; i++) {
            if ((a-b) % i == 0) {
                if (a/i > b) nums.add(a/i);
                if (i > b) nums.add(i);
            }
        }
        return String.valueOf(nums.size());
    }

    public void solve() throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] args = reader.readLine().split(" ");
        printf("%s\n", ans(Integer.parseInt(args[0]), Integer.parseInt(args[1])));
    }

    public static void main(String[] args) throws Exception {
        new B().solve();
    }

    public static void printf(String str, Object ... args) {
        System.out.printf(str, args);
    }

}

import java.util.*;

public class problem282_2 {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int num=in.nextInt();
        int rem=in.nextInt();
        if(rem>num)
            System.out.println("0");
        else if(rem==num)
            System.out.println("infinity");
        else{
            int number=num-rem;
            ArrayList<Integer> factors=new ArrayList<Integer>();
            for(int i=1;i<(int)Math.sqrt(number);++i){
                if(number%i==0){
                    factors.add(i);
                    factors.add(number/i);
                }
            }
            if(number==1)
                factors.add(1);
            else if(number==2){
                factors.add(1);
                factors.add(2);
            }
            else if(number==3){
                factors.add(1);
                factors.add(3);
            }
            int x=(int)Math.sqrt(number);
            if(number%x==0 && number!=1){
                factors.add(x);
                if(x!=number/x)
                    factors.add(number/x);
            }
            int count=0;
            for(int e:factors){
            if(e>rem)
                ++count;
            }
            System.out.println(""+count);
            }

    }
}

import java.util.*;

public class B {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt(),b=sc.nextInt(),x=0;
        if(a==b){System.out.print("infinity");return;}
        if(a>b)
        {
            int d=a-b;
            for(int i=1;i*i<d;i++)
            {
                if(d%i==0 && i>b)
                    x++;
                if( d%i==0 && i*i != d && d/i>b)
                    x++;
            }
        }
        System.out.print(x);
    }

}

import java.util.Scanner;

public class FOURNINEFIVEB
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextInt();
        double b = in.nextInt();
        double count = 0;
        long x = 0;
        long c = 0;

        if(a==b)
        {
            System.out.println("infinity");
            in.close();
        return;
        }
        while(x < a)
        {
            x++;
            if(a%x==b){
                c=x;
                count++;
            break;
            }
        }
        while(c < a)
        {
            c+=c;
            if(a%c==b)
                count++;
            break;
        }

        System.out.println((int)count);
        in.close();
    }

}

import java.util.*;
import java.util.Scanner;

public class B {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();

		if (a < b) {
			System.out.println(0);
		} else {
			if (a == b)
				System.out.println("infinity");
			else {
				int c = a-b;
				int count = 0;
				for (int i = 1; i*i<c; i++) {
					if (c%i == 0) {
						if (i <= b)
							count++;
						else
							count+=2;
					}
				}
				int i = (int)Math.sqrt(c);
				if (i > b && i*i == c ) {
					count++;
				}
				System.out.println(count);
			}
		}

		scan.close();
	}

}

import java.util.Scanner;

public class hello60 {
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();
		int target = a-b;
		int num = 0;
		for(int i = target ; i >= 1 ; i--){
			if(target % i ==0 && i > b ) num++;
			if(i <= b) break;
		}
		if(num !=0){
			System.out.println(num);
		}
		else{
			System.out.println("infinity");
		}
	}
}

/**
 * Created by user on 12/15/2014.
 */
import java.util.
        *;
public class three
{
    public static int[] arr = new int[1000000];
    public static Set<Long> set = new HashSet<Long>();
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        long a = input.nextLong();
        long b = input.nextLong();
        if(a > b)
        {
            int cnt = 0;
            long temp = a - b;
            set.add(new Long(temp));
            for(int i = 2; i < (int)Math.sqrt(temp)+ 20; i++)
            {
                if(temp % i == 0)
                {
                    set.add(new Long(i));
                    set.add(new Long(temp/i));
                }
            }
            Long[] khar = new Long[set.size()];
            set.toArray(khar);

            for(int i =0; i < khar.length; i++)
                if(khar[i] != 0 && khar[i] !=1 && a % khar[i] == b)
                    cnt ++;

            System.out.println(cnt);

        }
        else
        {
            System.out.println("infinity");
        }
    }
}

import java.io.* ;
import java.util.*;
public class Main2
{
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input)
    {
        reader = new BufferedReader( new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    static String next() throws IOException
    {
        while ( ! tokenizer.hasMoreTokens() )
        {
            tokenizer = new StringTokenizer(reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static long nextInt() throws IOException
    {
        return Long.parseLong( next() );
    }
    public static int ri() throws IOException
    {
    	return (int)nextInt() ;
    }
    public static long rl() throws IOException
    {
    	return nextInt() ;
    }
    public static double rd() throws NumberFormatException, IOException
    {
    	return Double.parseDouble(next()) ;
    }
    static void print_a(int [] arr)
    {
    	for(int i = 0 ;i<arr.length ; i++)
    	{
    		print(arr[i]+" ") ;
    	}
    	println() ;
    }
    public static int [] ria() throws IOException
    {
    	int n = ri() ;
    	int [] a = new int[n] ;
    	for(int i = 0 ; i<n ; i++)
    	{
    		a[i] = ri() ;
    	}
    	return a ;
    }
    public static long [] rla() throws IOException
    {
    	int n = ri() ;
    	long [] a = new long[n] ;
    	for(int i =0 ; i<n ; i++)
    	{
    		a[i] = rl() ;
    	}
    	return a ;
    }
    public static int p(int i)
    {
    	return (int)Math.pow(2,i) ;
    }
    static PrintWriter writer;
    static void outit(OutputStream outputStream)
    {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }
    static void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    static void println(Object...objects) {
        print(objects);
        writer.println();
    }

    static void close() {
        writer.close();
    }

    static void flush() {
        writer.flush();
    }
    public static void main(String [] args) throws IOException
    {
        init(System.in) ;
        outit(System.out) ;
//    	int t = (int)nextInt() ;
//    	for(int i =0 ; i<t ; i++)
        output() ;
        flush();
        close();
    }
    public static void output() throws IOException
    {
    	long a = rl() ;
    	long b = rl() ;
    	long d = a-b ;
    	if(d==0)
    	{
    		println("infinity") ;
    	}
    	else
    	{
    		printd(d,(int) b) ;
    	}
    }
    static void printd(long d,int b)
    {
    	int ctr= 0 ;
    	for(int i = 1 ; i<=Math.sqrt(d) ; i++)
    	{
    		if(d%i==0)
    		{
    			if(d*d==i)
    			{
    				if(d>b)
    				{
    					ctr++ ;
    				}
    			}
    			else
    			{
    				if(i>b)
    				{
    					ctr++ ;
    				}
    				if((d/i)>b)
    				{
    					ctr++ ;
    				}
    			}
    		}

    	}
    	println(ctr) ;
    }
}

import java.util.*;
public class Main {
  public static void main(String [] args){
  Scanner in=new Scanner(System.in);
  int a=in.nextInt();
  int b=in.nextInt();
  long cnt=0;
  if(a==b)System.out.print("infinity");
  else{
  int t=a-b;
  for(int i=1;i*i<=t;i++){
  if(t%i==0 && i*i==t && i>b)cnt++;
  if(t%i==0 && i>b && i*i<t)cnt+=2;
  if(t%i==0 && i<b && i*i<t)cnt++;
  }
  System.out.print(cnt);
  }
  }
}

import java.util.*;
import java.lang.*;
import java.math.*;
import java.awt.image.ConvolveOp;
import java.io.*;
import java.text.DecimalFormat;
import java.lang.reflect.Array;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.*;
public class Codeforces{
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long MOD = (long)(1e9+7);
	static FastReader sc = new FastReader();
	static int pInf = Integer.MAX_VALUE;
	static int nInf = Integer.MIN_VALUE;
	public static void main(String[] args){
		int test = 1;
		//test = sc.nextInt();
		while(test-->0){
			int a = sc.nextInt();
			int b = sc.nextInt();
			if(a==0 && b!=0) {
				out.print(0);
				continue;
			}
			if(b>=a) {
				out.println("infinity");
				continue;
			}
			int n = a-b;
			int count = 0;
			for(int i = 1; i <= Math.sqrt(n); i++) {
				if(n%i==0) {
					if(a%i==b) {
						count++;
					}
					if(n/i != i && a%(n/i)==b) {
						count++;
					}
				}
			}
			out.println(count);
  		}
		out.close();
	}
	public static long mul(long a, long b){
	    return ((a%MOD)*(b%MOD))%MOD;
	}
	public static long add(long a, long b){
	    return ((a%MOD)+(b%MOD))%MOD;
	}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Integer.lowestOneBit(i)   Equals k where k is the position of the first one in the binary
//Integer.highestOneBit(i)  Equals k where k is the position of the last one in the binary
//Integer.bitCount(i)       returns the number of one-bits
//Collections.sort(A,(p1,p2)->(int)(p2.x-p1.x)) To sort ArrayList in descending order wrt values of x.
//            Arrays.parallelSort(a,new Comparator<TPair>() {
//      		public int compare(TPair a,TPair b) {
//        			if(a.y==b.y) return a.x-b.x;
//        			return b.y-a.y;
//        		}
//        	});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//PrimeFactors
    public static ArrayList<Long> primeFactors(long n) {
        ArrayList<Long> arr = new ArrayList<>();
        if (n % 2 == 0)
            arr.add((long) 2);
        while (n % 2 == 0)
            n /= 2;
        for (long i = 3; i <= Math.sqrt(n); i += 2) {
            int flag = 0;
            while (n % i == 0) {
                n /= i;
                flag = 1;
            }
            if (flag == 1)
                arr.add(i);
        }
        if (n > 2)
            arr.add(n);
        return arr;
    }
//Pair Class
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
		@Override
		public int compareTo(Pair o) {
			if(this.x==o.x){
			    return (this.y-o.y);
			}
			return (this.x-o.x);
		}
	}
	static class TPair{
		long x;
		long y;
		public TPair(long x, long y) {
			this.x = x;
			this.y = y;
		}
	}
//Merge Sort
	static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
//Brian Kernighan’s Algorithm
    static long countSetBits(long n){
        if(n==0) return 0;
        return 1+countSetBits(n&(n-1));
    }
//Factorial
    static long factorial(long n){
        if(n==1) return 1;
        if(n==2) return 2;
        if(n==3) return 6;
        return n*factorial(n-1);
    }
//Euclidean Algorithm
    static long gcd(long A,long B){
        if(B==0) return A;
        return gcd(B,A%B);
    }
//Modular Exponentiation
    static long fastExpo(long x,long n){
        if(n==0) return 1;
        if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
        return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
    }
//AKS Algorithm
    static boolean isPrime(long n){
        if(n<=1) return false;
        if(n<=3) return true;
        if(n%2==0 || n%3==0) return false;
        for(int i=5;i<=Math.sqrt(n);i+=6)
            if(n%i==0 || n%(i+2)==0) return false;
        return true;
    }
//Reverse an array
    static <T> void reverse(T arr[],int l,int r){
    	Collections.reverse(Arrays.asList(arr).subList(l, r));
    }
//Sieve of eratosthenes
    static int[] findPrimes(int n){
        boolean isPrime[]=new boolean[n+1];
        ArrayList<Integer> a=new ArrayList<>();
        int result[];
        Arrays.fill(isPrime,true);
        isPrime[0]=false;
        isPrime[1]=false;
        for(int i=2;i*i<=n;++i){
            if(isPrime[i]==true){
                for(int j=i*i;j<=n;j+=i) isPrime[j]=false;
            }
        }
        for(int i=0;i<=n;i++) if(isPrime[i]==true) a.add(i);
        result=new int[a.size()];
        for(int i=0;i<a.size();i++) result[i]=a.get(i);
        return result;

    }
//Segmented Sieve
    static boolean[] segmentedSieve(long l, long r){
    	boolean[] segSieve = new boolean[(int)(r-l+1)];
    	Arrays.fill(segSieve, true);
    	int[] prePrimes = findPrimes((int)Math.sqrt(r));
    	for(int p:prePrimes) {
    		long low = (l/p)*p;
    		if(low < l) {
    			low += p;
    		}
    		if(low == p) {
    			low += p;
    		}
    		for(long j = low; j<= r; j += p) {
    			segSieve[(int) (j-l)] = false;
    		}
    	}
    	if(l==1) {
    		segSieve[0] = false;
    	}
    	return segSieve;
    }
//Euler Totent function
    static long countCoprimes(long n){
        ArrayList<Long> prime_factors=new ArrayList<>();
        long x=n,flag=0;
        while(x%2==0){
            if(flag==0) prime_factors.add(2L);
            flag=1;
            x/=2;
        }
        for(long i=3;i*i<=x;i+=2){
            flag=0;
            while(x%i==0){
                if(flag==0) prime_factors.add(i);
                flag=1;
                x/=i;
            }
        }
        if(x>2) prime_factors.add(x);
        double ans=(double)n;
        for(Long p:prime_factors){
            ans*=(1.0-(Double)1.0/p);
        }
        return (long)ans;
    }
	static long modulo = (long)1e9+7;
	public static long modinv(long x){
	    return modpow(x, modulo-2);
	}
	public static long modpow(long a, long b){
	    if(b==0){
	        return 1;
	    }
	    long x = modpow(a, b/2);
	    x = (x*x)%modulo;
	    if(b%2==1){
	        return (x*a)%modulo;
	    }
	    return x;
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        int a = nextInt();
        int b = nextInt();
        if(a == b) {
            System.out.println("infinity");
        } else {
            int x = a - b;
            int j = 0;
            for (int i = 2; i <= Math.sqrt(x); i++) {
                if(x % i == 0) j++;
            }
            System.out.println(j);
        }
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
            br.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(239);
        }
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    public static void main(String[] args) {
        new Main().run();
    }
}

/**
 * Created by user on 12/15/2014.
 */
import java.util.
        *;
public class three
{
    public static int[] arr = new int[1000000];
    public static Set<Long> set = new HashSet<Long>();
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        long a = input.nextLong();
        long b = input.nextLong();
        if(a == b)
        {
            System.out.println("infinity");
            return;
        }
        if(a < b)
        {
            System.out.println(0);
            return;
        }
            int cnt = 0;
            long temp = a - b;
            set.add(new Long(temp));
            for(int i = 2; i < (int)Math.sqrt(temp)+ 20; i++)
            {
                if(temp % i == 0)
                {
                    set.add(new Long(i));
                    set.add(new Long(temp/i));
                }
            }
            Long[] khar = new Long[set.size()];
            set.toArray(khar);

            for(int i =0; i < khar.length; i++)
                if(khar[i] != 0 && khar[i] !=1 && a % khar[i] == b)
                    cnt ++;

            System.out.println(cnt);

    }
}

import java.util.Scanner;

public class FOURNINEFIVEB1{

    public static void main(String[] args){

        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();
        int count = 0;
        int x = b;

        if(a==b)
        {
            System.out.println("infinity");
            in.close();
        return;
        }
        while(x < a)
        {
            x++;
            if(a%x==b){
                x+=b;

                count++;
            }
        }
        System.out.println(count);
        in.close();
    }
}

import java.io.*;
import java.util.*;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class fast{

static class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int length = readInt();
        if (length < 0)
            return null;
        byte[] bytes = new byte[length];
        for (int i = 0; i < length; i++)
            bytes[i] = (byte) read();
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return new String(bytes);
        }
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuffer buf = new StringBuffer();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r')
                buf.appendCodePoint(c);
            c = read();
        }
        return buf.toString();
    }

    public String readLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines)
            return readLine();
        else
            return readLine0();
    }

    public BigInteger readBigInteger() {
        try {
            return new BigInteger(readString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return readString();
    }

    public boolean readBoolean() {
        return readInt() == 1;
    }
}
static int b;
static int divisor(int x){
        if(x==1)
            return 1;
	    int limit = x;
	    int numberOfDivisors = 0;

	    for (int i=1; i < limit; ++i) {
	        if (x % i == 0) {
	            limit = x / i;
	            if (limit != i) {
	                numberOfDivisors++;
	            }
                    if(i>b)
	            numberOfDivisors++;
	        }
	    }
	    return numberOfDivisors;
    }

            public static void main (String[] args) throws Exception{
            InputReader s = new InputReader(System.in);
            PrintWriter ww = new PrintWriter(System.out,true);
            int a=s.readInt();
            b=s.readInt();
            int rem=a-b;
        //    System.out.println(divisor(a));
            if(a==b)
                ww.println("infinity");
            else if((rem<0)&&(a!=0))
                ww.println("infinity");
            else if((rem<=0)&&(a==0))
                ww.println("0");

            else{
                if(b==0){
                    ww.println(divisor(a));
                }
                else{
                int ans=divisor(rem);

                ww.println(ans);
                }
            }
            ww.close();
       }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public final class CF_Modular {

	void log(int[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}

	void log(long[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}
	void log(Object[] X){
		int L=X.length;
		for (int i=0;i<L;i++){
			logWln(X[i]+" ");
		}
		log("");
	}

	void log(Object o){
		logWln(o+"\n");
	}

	void logWln(Object o){
		//System.out.print(o);
		outputWln(o);

	}
	void info(Object o){
		System.out.println(o);
		//output(o);
	}

	void output(Object o){

		outputWln(""+o+"\n");

	}

	void outputWln(Object o){
		// System.out.print(o);

		try {
			out.write(""+ o);
		} catch (Exception e) {

		}
	}

	String next(){
		while (st== null|| !st.hasMoreTokens()) {
			try {
				st=new StringTokenizer(in.readLine());
			} catch (Exception e) {
			}
		}
		return st.nextToken();
	}

	String nextLine(){
		try {
			return in.readLine();
		} catch (Exception e) {
		}
		return null;
	}

	int nextInt(){
		return Integer.parseInt(next());
	}

	long nextLong(){
		return Long.parseLong(next());

	}

	// Global vars
	StringTokenizer st;
	BufferedReader in;
	BufferedWriter out;

	void solve(int a,int b){

		ArrayList<Integer> divisors=new ArrayList<Integer>();
		ArrayList<Integer> coef=new ArrayList<Integer>();
		if (b>a){
			output("0");
			return;
		}
		if (a==b) {
			output("infinity");
			return;
		}

		int delta=a-b;
		if (delta<=b) {
			output("0");
			return;
		}
		int cnt=1;
		for (int i=2;i*i<=delta;i++){
			//log("delta:"+delta);
			//log("i:"+i+" delta%i"+(delta%i));
			if (delta % i==0){

				if (i>b) {
					cnt++;
					//log(i);
				}
				if (delta/i>b && delta/i!=i){
				//	log(delta/i);
					cnt++;
				}
			}
		}
		output(cnt);
	}

	void process() throws Exception {

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		in=new BufferedReader(new InputStreamReader(System.in));

		int a=nextInt();
		int b=nextInt();
		solve(a,b);

		try {
			out.close();
		}
		catch (Exception e){}

	}

	public static void main(String[] args) throws Exception {
		CF_Modular J=new CF_Modular();

		J.process();

	}

}

import java.util.*;

public class r495b {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		n = n - k;
		if (n<0) {
			System.out.println(0);
		} else if (n==0) {
			System.out.println("infinity");
		} else {
			// n>0
			int count = 0;
			for (int i = 1; i*i<=n; i++) {
				if (n%i==0) {
					count += 2;
					if (i<=k) {
						count -= 1;
					}
					if (n/i<=k) {
						count -= 1;
					}
				}
			}
			System.out.println(count);
		}
	}
}

import java.io.*; //PrintWriter
import java.math.*; //BigInteger, BigDecimal
import java.util.*; //StringTokenizer, ArrayList

public class Main {
    FastReader in;
    PrintWriter out;

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        in = new FastReader(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    void solve() {
        int a = in.nextInt();
        int b = in.nextInt();
        if(b>=a)
            out.println("infinity");
        else{
            int cnt = 0;
            int base = b+1;
            while(base<a){
                if((a-b)%base == 0 && base > b){
//                    out.println(base);
                    cnt++;

                }
                base++;

            }
            out.println(cnt);
        }
    }
    // -----------------------------------------------------
    void runWithFiles() {
        in = new FastReader(new File("input.txt"));
        try {
            out = new PrintWriter(new File("output.txt"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        solve();
        out.close();
    }

    class FastReader {
        BufferedReader br;
        StringTokenizer tokenizer;

        public FastReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public FastReader(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
                tokenizer = null;
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        private String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens())
                try {
                    tokenizer = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            try {
                return br.readLine();
            } catch (Exception e) {
                throw (new RuntimeException());
            }
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        if (a == b) {
            System.out.println("infinity");
        } else {
            System.out.println(mod(a, b));
        }
    }

    private static int mod(int a, int b) {
        int number = a - b;
        int counter = 0;
        int noNeed = 0;
        boolean isEqual = false;
        double sqrt =  Math.sqrt(number);
        if(b > number) {
            return 0;
        }
        for (int i = 1; i <= sqrt; i++) {
            if (number % i == 0) {
                counter++;
            }
            if (number % i == 0 && i <= b) {
                noNeed++;
            }
            if (i == sqrt) {
                isEqual = true;
            }
        }

        if (!isEqual) {
            return counter * 2 - noNeed;
        } else {
            return counter * 2 - noNeed - 1;
        }
    }
}

import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ost = a - b;
        int n = 0;
        for (int i = b + 1; i <= ost; i++) {
            if (ost % i == 0)
                n++;
        }
        System.out.println(n);
    }

}

import java.util.Scanner;

public class FOURNINEFIVEB
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        long count = 0;
        long x = 0;
        long c = 0;

        if(a==b){
            System.out.println("infinity");
            in.close();
        return;
        }
        while(x < a){
            x++;
            if(a%x==b){
                c=x;
            break;
            }
        }
        while(a>c){
        count++;
        c*=2;
        }

        System.out.println(count);
        in.close();
    }
}

// package Div2;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

public class Sketch {
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int a = input.nextInt();
		int b = input.nextInt();

		if(a < b){
			System.out.println(0);
			return;
		}
		if(a == b){
			System.out.println("infinity");
			return;
		}

		int gap = a-b;
		int count = 0;
		int sqrt = (int) Math.sqrt(gap);
		for(int i=1; i<sqrt; i++){
			if(gap % i == 0)
				count++;
		}
		count = count << 1;
		if(gap % sqrt == 0)
			count ++;
		for(int i=2; i<=b; i++){
			if(gap % i==0)
				count--;
		}

		System.out.println(count);
	}
}

import java.awt.Point;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Testing {

    FastScanner in;
    PrintWriter out;
    public void solve() throws IOException
    {
        int n = in.nextInt();
        int m = in.nextInt();

        int result = 1;

        if (n == m)
            out.println("infinity");
        else
            if (n<m)
                out.println(result);
            else{
//              x = n - m;
//
//              int k = 1;
//              int x1 = x;
//
//              while (x/k > m){
//                  if (x%k == 0){
//
//                      result++;
//                  }
//                  k++;
//              }

                //if (x)
                int t = n - m;

                if (t - m < m){
                    for (int i=t; i>m; i--)
                        if (t%i == 0)
                            result++;
                }
                else
                {
                    int k = 2;

                    while (t > 1){
                        int cur = 1;
                        while (t % k == 0){
                            cur++;
                            t/=k;
                        }
                        k++;
                        result*=cur;
                    }
                    //out.println(t);
                    for (int i=1; i<=m; i++)
                        if ((n-m)%i == 0)
                            result--;
                }

                out.println(result);
            }

    }

    public void run()
    {
        try
        {
            in  = new FastScanner();
            out = new PrintWriter(System.out);

            //in     = new FastScanner(new File("knapsack.in"));
            //out = new PrintWriter(new File("knapsack.out"));

            solve();

            out.close();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    class FastScanner
    {
        BufferedReader  br;
        StringTokenizer st;

        FastScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        FastScanner(File f)
        {
            try
            {
                br = new BufferedReader(new FileReader(f));
            }
            catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
        }

        String nextLine()
        {
            String ret = null;
            try
        {
                ret = br.readLine();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

            return ret;
        }

        String next()
        {
            while (st == null || !st.hasMoreTokens())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++)
            {
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++)
            {
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index)
            {
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);

                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new Testing().run();
    }
}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    // write your code here
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        if(a == b) {
            System.out.println("infinity");
        } else {
            System.out.println(mod(a, b));
        }
    }

    private static int mod(int a, int b) {
        int number = a-b;
        int counter = 0;
        int noNeed = 0;
        for(int i = 1; i <= Math.sqrt(number); i++) {
            if(number%i == 0) {
                counter++;
            }
            if(number%i == 0 && i<b) {
                noNeed++;
            }
        }
        return counter*2-noNeed;
    }
}

import java.util.Scanner;

public class FOURNINEFIVEB1{

    public static void main(String[] args){

        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();
        int count = 0;
        int x = b;

        if(a==b)
        {
            System.out.println("infinity");
            in.close();
        return;
        }
        while(x < a)
        {
            x++;
            if(a%x==b){
                x+=2*Math.sqrt(x*1.0)-1;

                count++;
            }
        }
        System.out.println(count);
        in.close();
    }
}

import java.util.*;

public class r495b {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		n = n - k;
		if (n<0) {
			System.out.println(0);
		} else if (n==0) {
			System.out.println("infinity");
		} else {
			// n>0
			int count = 0;
			for (int i = 1; i*i<=n; i++) {
				if (i>k) {
					count += 1;
				}
				if (n/i>k) {
					count += 1;
				}
			}
			System.out.println(count);
		}
	}
}

import java.util.*;
import java.io.*;

public class B495
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		long a = in.nextLong();
		long b = in.nextLong();

		long x = a - b;

		if(b==0 || x==0)
			System.out.println("infinity");
		else
		{
			if(x<0)
				System.out.println(0);
			else
				System.out.println(Divisors(x,b));
		}
	}

	public static long Divisors(long n, long x)
	{
	    long ans=0;

	    for (int i=1; i<=Math.sqrt(n); i++)
	    {
	        if (n%i == 0)
	        {
	            if (n/i == i)
	            {
	            	if(i>x)
	            		ans++;
	            }
	            else
	            {
	            	if(i>x)
	            		ans++;
	            	if(n/i>x)
	            		ans++;
	            }
	        }
	    }
	    return ans;
	}
}

import java.util.Scanner;

public class FOURNINEFIVEB
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextInt();
        double b = in.nextInt();
        double count = 0;
        long x = 0;
        long c = 0;

        if(a==b)
        {
            System.out.println("infinity");
            in.close();
        return;
        }
        while(x < a)
        {
            x++;
            if(a%x==b){
                c=x;
                count++;
            break;
            }
        }
        while(c < a)
        {
            c+=c;
            if(a%c==b)
                count++;
            break;
        }

        System.out.println((int)count);
        in.close();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Random;
import java.util.StringTokenizer;

public class B {

  static BufferedReader in;
  static PrintWriter out;
  static StringTokenizer tok;

  static void solve() throws Exception {
    long a = nextLong();
    long b = nextLong();
    if (a < b)
      out.println(0);
    else if (a == b)
      out.println("infinity");
    else {
      long c = a - b;
      if (c <= b)
        out.println(0);
      else {
        long count = 1;
        for (long i = 2; i < Math.sqrt(c) + 1; i++)
          if (c % i == 0) {
            if (i > b && i != c)
              count++;
            if (c / i > b && i != c / i && c / i != c)
              count++;
          }
        out.println(count);
      }
    }
  }

  public static void main(String args[]) {
    try {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(new OutputStreamWriter(System.out));
      // in = new BufferedReader(new FileReader("input.in"));
      // out = new PrintWriter(new FileWriter("output.out"));
      solve();
      in.close();
      out.close();
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(1);
    }
  }

  static int nextInt() throws IOException {
    return Integer.parseInt(next());
  }

  static long nextLong() throws IOException {
    return Long.parseLong(next());
  }

  static double nextDouble() throws IOException {
    return Double.parseDouble(next());
  }

  static BigInteger nextBigInteger() throws IOException {
    return new BigInteger(next());
  }

  static String next() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      tok = new StringTokenizer(in.readLine());
    }
    return tok.nextToken();
  }

  static String nextLine() throws IOException {
    tok = new StringTokenizer("");
    return in.readLine();
  }

  static boolean hasNext() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      String s = in.readLine();
      if (s == null) {
        return false;
      }
      tok = new StringTokenizer(s);
    }
    return true;
  }

  static void shuffleArray(long[] array) {
    Random random = new Random();
    for (int i = array.length - 1; i > 0; i--) {
      int index = random.nextInt(i + 1);
      long temp = array[index];
      array[index] = array[i];
      array[i] = temp;
    }
  }

}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class B {

    private String ans(int a, int b) {
        if (a == b) return "infinity";
        else if (a < b) return "0";
        int res = 1;
        for (int i = 2; i*i < a-b; i++) {
            if ((a-b) % i == 0) {
                if (a/i > b) res++;
                if (i > b) res++;
            }
        }
        return String.valueOf(res);
    }

    public void solve() throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] args = reader.readLine().split(" ");
        printf("%s\n", ans(Integer.parseInt(args[0]), Integer.parseInt(args[1])));
    }

    public static void main(String[] args) throws Exception {
        new B().solve();
    }

    public static void printf(String str, Object ... args) {
        System.out.printf(str, args);
    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.InputMismatchException;

public class Main {

	public static void main(String[] args) {
		Task mSol = new Task();
		mSol.solve();
		mSol.flush();
		mSol.close();
	}

}

class Task {

	public FasterScanner mFScanner;
	public PrintWriter mOut;
	private HashMap<Integer, Integer> mFactors;
	int total = 1;
	private ArrayList<Integer> array;
	int BB;

	public Task() {
		mFScanner = new FasterScanner();
		mOut = new PrintWriter(System.out);
	}

	public void solve() {

		int a, b;
		int sqrt;
		int diff;

		a = mFScanner.nextInt();
		b = mFScanner.nextInt();
		mFactors = new HashMap<Integer, Integer>();
		array = new ArrayList<Integer>();

		if (b > a) {
			mOut.println(0);
			return;
		}

		if (b == a) {
			mOut.println("infinity");
			return;
		}

		sqrt = (int) Math.sqrt(a);

		diff = a - b;

		boolean prime[] = new boolean[sqrt + 1];
		sieveOfEratosThenes(prime, sqrt);

		for (int i = 2; i <= sqrt && diff != 1; i++) {

			if (!prime[i] || diff % i != 0)
				continue;

			int count = 0;

			while (diff % i == 0) {
				diff /= i;
				count++;
			}

			mFactors.put(i, count);
			array.add(i);

			total *= (count + 1);

		}

		if (diff != 1) {
			mFactors.put(diff, 1);
			total *= 2;
		}

		BB = b;

		rec(1, 0, 0);

		if (BB != 0)
			total--;
		mOut.println(total);

		return;

	}

	public void rec(int num, int index, int count) {

		if (num > BB || index == array.size())
			return;

		if (count != 0) {
//			System.out.println(num);
			total--;
		}

		if (count < mFactors.get(array.get(index))) {
			int tempNum = num * array.get(index);
			rec(tempNum, index, count + 1);
		}

		rec(num, index + 1, 0);

	}

	public void sieveOfEratosThenes(boolean[] prime, int N) {

		int i;
		long j;

		for (i = 2; i < N + 1; i++) {
			prime[i] = true;
		}

		for (i = 2; i < N + 1; i++) {

			j = 1L * i * i;

			if (!prime[i])
				continue;

			while (j < N + 1) {
				prime[(int) j] = false;
				j += i;
			}
		}

	}

	public void flush() {
		mOut.flush();
	}

	public void close() {
		mOut.close();
	}
}

class FasterScanner {
	private InputStream mIs;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;

	public FasterScanner() {
		this(System.in);
	}

	public FasterScanner(InputStream is) {
		mIs = is;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = mIs.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	public String nextString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long nextLong() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int nextInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

}

import java.io.*;
import java.util.*;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;

public class Java {

    private static final int INF = (int) 1e9 + 3;

    private static InputReader in;
    private static PrintWriter out;

    private static void test0() throws IOException {
        int a = in.nextInt();
        int b = in.nextInt();
        if (a - b <= 0) {
            out.printf("infinity\n");
            return;
        }

        out.printf("%d\n", calc_num_of_divisors(a - b, b));
    }

    private static int calc_num_of_divisors(int n, int b) {
        int res = 0;
        for (int div = 1; div * div <= n; ++div) {
            if (div * div == n) {
                res += div > b ? 1 : 0;
                continue;
            }
            if (n % div == 0) {
                res += (div > b ? 1 : 0) + ((n / div) > b ? 1 : 0);
            }
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        init_io(args.length > 0 && Objects.equals(args[0], "MINE"));

        test0();

        out.flush();
    }

    private static long sqr(int x) {
        return (long) x * x;
    }

    private static void init_io(boolean myMachine) throws FileNotFoundException {
        in = new InputReader(myMachine ? new FileInputStream("input.txt") : System.in);
        out = new PrintWriter(System.out);
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");

    }

    String nextLine() throws IOException {
        if (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken("");
    }

    String nextWord() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(this.nextLine());
        }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(this.nextWord());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(this.nextWord());
    }
}

import java.io.*;
import java.util.*;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class fast{

static class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int length = readInt();
        if (length < 0)
            return null;
        byte[] bytes = new byte[length];
        for (int i = 0; i < length; i++)
            bytes[i] = (byte) read();
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return new String(bytes);
        }
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuffer buf = new StringBuffer();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r')
                buf.appendCodePoint(c);
            c = read();
        }
        return buf.toString();
    }

    public String readLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines)
            return readLine();
        else
            return readLine0();
    }

    public BigInteger readBigInteger() {
        try {
            return new BigInteger(readString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return readString();
    }

    public boolean readBoolean() {
        return readInt() == 1;
    }
}
static int divisor(int x){
	    int limit = x;
	    int numberOfDivisors = 0;

	    for (int i=1; i < limit; ++i) {
	        if (x % i == 0) {
	            limit = x / i;
	            if (limit != i) {
	                numberOfDivisors++;
	            }
	            numberOfDivisors++;
	        }
	    }
	    return numberOfDivisors;
    }

            public static void main (String[] args) throws Exception{
            InputReader s = new InputReader(System.in);
            PrintWriter ww = new PrintWriter(System.out,true);
            int a=s.readInt();
            int b=s.readInt();
            int rem=a-b;
            if(rem<=0)
                ww.println("infinity");
            else{

                int ans=divisor(rem);
                int temp=0;
                for(int i=1;i<=b;i++)
                    if(rem%i==0)
                        temp++;
                ww.println(ans-temp);
            }
            ww.close();
       }
}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

public class B495 {

    public static BufferedReader in;
    public static PrintWriter out;
    public static StringTokenizer tokenizer;

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        in = new BufferedReader(new InputStreamReader(inputStream), 32768);
        out = new PrintWriter(outputStream);
        solve();
        out.close();
    }

    public static void solve() {
        int a = nextInt();
        int b = nextInt();
        if (a <= b && a > 0) {
            out.println("infinity");
            return;
        }
        int res = 0;
        if (a > 0) {
            res++;
        }
        int x = a - b;
        if (b == 0) {
            res++;
        }
        for (int i = 2; i * i <= x; i++) {
            if (x % i == 0) {
                if (i > b) {
                    res++;
                }
                int s = x / i;
                if (s > b) {
                    res++;
                }
            }
        }
        out.println(res);
    }

    public static String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public static int nextInt() {
        return Integer.parseInt(next());
    }

    public static long nextLong() {
        return Long.parseLong(next());
    }

    public static double nextDouble() {
        return Double.parseDouble(next());
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        int a = nextInt();
        int b = nextInt();
        if(a == b) {
            System.out.println("infinity");
        } else {
            int x = a - b;
            int j = 0;
            for (int i = 2; i <= Math.sqrt(x); i++) {
                if(a % i == 0) j++;
            }
            System.out.println(j);
        }
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
            br.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(239);
        }
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    public static void main(String[] args) {
        new Main().run();
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public final class Solution
{
    public static void main(String[] args)
    {
   	 Reader input = new Reader();
     PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
     int a = input.nextInt(), b = input.nextInt();
     int n = a - b;
     int root = (int)Math.sqrt(n);
     int count = 0;
     if(b == a)
     {
    	 out.println("infinity");
    	 out.close();
    	 return;
     }
     else if(b > a)
     {
    	 out.println(0);
    	 out.close();
    	 return;
     }
     for(int i = 1 ; i <= root ; i++)
     {
    	 if(n % i == 0)
    	 {
    		 if(i > b)
    			 count++;
    		 if(n / i > b)
    			 count++;
    	 }
     }
     out.println(count);
	 out.close();
    }
    public static int z(int n)
    {
    	/*finds the number of trailing zeros in factorial */
    	int count = 0;
    	for(int i = 5 ; i <= n ; i *= 5)
    	{
    		count += n / i;
    	}
    	return count;
    }
    public static int gcd(int a , int b)
    {
    	if(b == 0)
    		return a;
    	return gcd(b , a %b);
    }
    public static class Pair implements Comparable<Pair>
    {
    	int a ,  b;
    	public Pair(int a , int b)
    	{
    		this.a = a;
    		this.b = b;
    	}
		@Override
		public int compareTo(Pair t) {
			// TODO Auto-generated method stub
    		if(t.a == this.a)
    		{
    			if(this.b < t.b)
    				return -1;
    			else if(this.b > t.b)
    				return 1;
    			else
    				return 0;
    		}
    		else if(this.a < t.a)
    			return -1;
    		else
    			return 1;
		}
    }
    public static class Reader
    {
    	BufferedReader br;
    	StringTokenizer st;
    	public Reader()
    	{
    		br = new BufferedReader(new InputStreamReader(System.in));
    	}
    	public String next()
    	{
    		try
    		{
        		if(st == null || !st.hasMoreTokens())
        			st = new StringTokenizer(br.readLine());
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return st.nextToken();
    	}
    	public int nextInt()
    	{
    		return Integer.parseInt(next());
    	}
    	public double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
    	public long nextLong()
    	{
    		return Long.parseLong(next());
    	}
    	public String nextLine()
    	{
    		try
    		{
    			return br.readLine();
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return "";
    	}
    }
}

/*
PROG: b
LANG: JAVA
*/
import java.util.*;
import java.io.*;

public class b {

  private void solve() throws Exception {
    //BufferedReader br = new BufferedReader(new FileReader("b.in"));
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] pa = br.readLine().split(" ");
    long a = Long.parseLong(pa[0]);
    long b = Long.parseLong(pa[1]);

    long n = a - b, r = 0;
    if(n <= 0) {
      System.out.println("infinity");
    } else {
      for(long i = 1; i * i <= n; ++i) {
        long j = n / i;
        //debug(i, j, a % i, a % j);
        if(a % j == b) ++r;
        if(i != j && a % i == b) ++r;
      }
      System.out.println(r);
    }

  }

  public static void main(String[] args) throws Exception {
    new b().solve();
  }

  static void debug(Object...o) {
    System.err.println(Arrays.deepToString(o));
  }

}

import java.util.Scanner;

public class B495 {

    public static void main(String... xxx)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int c = a - b;
        if (a - 1 <= b){System.out.println("infinity");return;}

        int ans = 1;
        for (int i = b + 1; i < c; i++)
        {
            if (c % i == 0)ans++;
        }

        System.out.println(ans);
    }
}

import java.util.Scanner;

public class FOURNINEFIVEB1
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextInt();
        double b = in.nextInt();
        double count = 0;
        long x = 0;

        if(a==b)
        {
            System.out.println("infinity");
            in.close();
        return;
        }
        while(x*2 < a)
        {
            x++;
            if(a%x==b)
                count++;
        }
        System.out.println((int)count *2 );
        in.close();
    }

}

import java.io.*;
import java.util.*;

public class template {
  static class InputReader {
    private final BufferedReader br;
    private StringTokenizer st;

    InputReader(final InputStream in) {
      br = new BufferedReader(new InputStreamReader(in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (final IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      final String res = null;
      while (res == null || res.isEmpty()) {
        try {
          return br.readLine();
        } catch (final IOException e) {
          e.printStackTrace();
        }
      }
      return res;
    }
  }

  public static void main(final String[] args) {
    final var in = new InputReader(System.in);
    final var out = new PrintWriter(System.out);
    new template().solve(in, out);
    out.close();
  }

  void solve(InputReader in, PrintWriter out) {
    int a = in.nextInt(), b = in.nextInt();
    int c = a - b;
    if (c == 0) {
      out.print("infinity");
      return;
    }

    int count = 0;
    for (int i = 1; i <= Math.sqrt(c); ++i) {
      if (c % i == 0) {
        if (i > b) {
          ++count;
        }
        if (c > b * i) {
          ++count;
        }
      }
    }
    out.print(count);
  }
}

import java.util.Scanner;
public class main
{
    public static void main(String args[])
    {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        float x = a-b;
        float temp = x;
        int count = 1;
        int i = 2;
        if(x == 0)
        {
            System.out.println("infinity");
            System.exit(0);
        }
        while(i < Math.sqrt(a-b))
        {
            if(a%i == b)
            {
                count += 1;
            }
            if(a%((a-b)/i) == b)
            {
                count += 1;
            }
            i++;
        }
        System.out.println(count);
    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Main {
    final boolean isContest = true;
    //region shit

    BufferedReader in;
    PrintWriter out;
    StringTokenizer stringTokenizer;

    public static void main(String[] args) throws Exception {
        Main sol = new Main();
        if (sol.isContest) {
            sol.in = new BufferedReader(new InputStreamReader(System.in));
            sol.out = new PrintWriter(System.out);
        } else {
            sol.in = new BufferedReader(new FileReader("input.txt"));
            sol.out = new PrintWriter("output.txt");
        }
        sol.solve();
        sol.in.close();
        sol.out.close();
    }

    private int nextInt() throws NumberFormatException, IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws NumberFormatException, IOException {
        return Long.parseLong(nextToken());
    }

    private String nextToken() throws IOException {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            stringTokenizer = new StringTokenizer(in.readLine());
        }
        return stringTokenizer.nextToken();
    }
    //endregion

    private void solve() throws Exception {
        long a = nextLong();
        long b = nextLong();
        out.println(answer(a, b));
    }

    private String answer(long a, long b) {
        if (a < b) {
            return "0";
        }
        if (a == b) {
            return "Infinity";
        }
        return Long.toString(nDivisors(a - b, b + 1));
    }

    long nDivisors(long a, long lowerBound) {
        long sum = 0;
        long upperBound = (long) (Math.sqrt(a));
        for (long i = 1; i <= upperBound; i++) {
            if (a % i == 0) {
                if (i >= lowerBound) {
//                    out.println(i);
                    sum++;
                }
                if (a / i >= lowerBound && a != i * i) {
//                    out.println(a / i);
                    sum++;
                }
            }
        }
        return sum;
    }
}