252662256 252662260
 141650963 141650963
 4 12
 1002523 1002523
 93 95
 331900277 331900277
 56 92
 10 100
 3 1000000000
 13 13
 2 879190747
 999900001 1000000000
 820844234 892579936
 419873015 419873018
 568814539 568814539
 999999937 999999937
 519002744 519002744
 80270976 80270977
 5 10
 3 6
 392602363 392602367
 6 12
 634097178 634097179
 6 15
 3 10
 305693653 305693653
 2 3
 1200007 1200007
 5 100
 10000019 10000019
 720270740 720270743
 94 95
 908580370 968054552
 760632746 850720703
 900000011 900000011
 37622224 162971117
 5 5
 76 134
 3 12
 39 91
 999992977 999992977
 17 17
 29 29
 770439256 770439256
 347877978 913527175
 3 8
 5 15
 349533413 349533413
 100000007 100000007
 104729 104729
 900000000 1000000000
 479001599 479001599
 999727999 999727999
 1717 1717
 15 27
 100003 100003
 51 52
 17 35
 1000003 1000003
 6 8
 11 11
 741254764 741254768
 2 2
 30 37
 2 1000000000
 4 8
 620769961 988145114
 951594860 953554446
 450868287 450868290
 575062045 575062049
 28829775 28829776
 999999797 999999797
 990000023 990000023
 871232720 871232722
 242 244
 273072892 273072894
 2 999999999
 7 7
 38 98
 39916801 39916801
 998244353 998244353
 3 111111
 3 3
 982451653 982451653
 3 18
 47 52
 999999103 999999103
 999999929 999999929
 3 99
 715827883 715827883
 12 18
 999999733 999999733

2
 141650963
 2
 1002523
 2
 331900277
 2
 2
 2
 13
 2
 2
 2
 2
 568814539
 999999937
 519002744
 2
 2
 2
 2
 2
 2
 2
 2
 305693653
 2
 1200007
 2
 10000019
 2
 2
 2
 2
 900000011
 2
 5
 2
 2
 2
 999992977
 17
 29
 770439256
 2
 2
 2
 349533413
 100000007
 104729
 2
 479001599
 999727999
 1717
 2
 100003
 2
 2
 1000003
 2
 11
 2
 2
 2
 2
 2
 2
 2
 2
 2
 2
 999999797
 990000023
 2
 2
 2
 2
 7
 2
 39916801
 998244353
 2
 3
 982451653
 2
 2
 999999103
 999999929
 2
 715827883
 2
 999999733

// Code Author: Shrey Shah
 
import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;


public class Tester2 {

	static double eps=(double)1e-6;
	static long mod=(int)1e9+7;
	public static void main(String args[]){
		InputReader sc = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//----------My Code----------
		long l = sc.nextLong();
		long r = sc.nextLong();
		if(l!=r)
			out.print(2);
		else
		{
			int flag=0;
			if(l%2==0)
			{
				out.println(2);
				flag=1;
			}
				else
			{
				for(int i=3;i*i<=l;i+=2)
				{	
					if(l%i==0)
					{
						out.println(i);
						flag=1;
					}
				}
			}
			if(flag==0)
				out.println(l);
		}
		//---The End-----------------
		out.close();
	}

	 static int power(int x,int n)
	{
	    if(n==0)
	        return 1;
	    else if(n%2 == 0)        //n is even
	        return power(x*x,n/2);
	    else                             //n is odd
	        return x*power(x*x,(n-1)/2);
	}
	 static long ce(long x)
		{
			if(x%2!=0)
				return x/2+1;
			return x/2;
		}
	static boolean isSubSequence(String str1, String str2, int m, int n)
	{
	   int j = 0;
	   for (int i=0; i<n&&j<m; i++)
	       if (str1.charAt(j) == str2.charAt(i))
	         j++;
	 
	   return (j==m);
	}
		
	static long fibo(long l) {
        if (l < 0) {
            throw new IllegalArgumentException("The fibo value cannot be negative");
        }

        if (l <= 1) return l;

        long[][] result = {{1, 0}, {0, 1}}; // identity matrix.
        long[][] fiboM = {{1, 1}, {1, 0}};

        while (l > 0) {
            if (l%2 == 1) {
                multMatrix(result, fiboM);
            }
            l = l / 2;
            multMatrix(fiboM, fiboM);
        }

        return result[1][0];
    }

    private static void multMatrix(long[][] result, long[][] fiboM) {
        long a = (result[0][0]%mod * fiboM[0][0]%mod)%mod +  (result[0][1]%mod * fiboM[1][0]%mod)%mod;
        long b = (result[0][0]%mod * fiboM[0][1]%mod)%mod + ( result[0][1]%mod * fiboM[1][1]%mod)%mod;
        long c = (result[1][0]%mod * fiboM[0][0]%mod)%mod + ( result[1][1]%mod * fiboM[0][1]%mod)%mod;
        long d = (result[1][0]%mod * fiboM[0][1]%mod)%mod +  (result[1][1]%mod * fiboM[1][1]%mod)%mod;

        result[0][0] = a;
        result[0][1] = b;
        result[1][0] = c;
        result[1][1] = d;
    }
    
    
	static int[] sieve(int n,int[] arr)
	{
		for(int i=2;i*i<=n;i++)
		{
			if(arr[i]==0)
			{
				for(int j=i*2;j<=n;j+=i)
					arr[j]=1;
			}
		}
		return arr;
	}
	
	static boolean isPal(String s)
	{
		for(int i=0, j=s.length()-1;i<=j;i++,j--)
		{
			if(s.charAt(i)!=s.charAt(j)) return false;
		}
		return true;
	}
	public static String rev(String s)
	{
		StringBuilder sb=new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}
	    
	static long lcm(long a, long b)
	{
	    return a * (b / gcd(a, b));
	}
	
	static long gcd(long a, long b)
	{
	    while (b > 0)
	    {
	        long temp = b;
	        b = a % b; // % is remainder
	        a = temp;
	    }
	    return a;
	}
	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		int i;
		Pair(int xx,int yy){
			x=xx;
			y=yy;
		}
		public Pair() {
			// TODO Auto-generated constructor stub
		}
		@Override
		public int compareTo(Pair o) {
			return Integer.compare(this.x, o.x);
		}
	}

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

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

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		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 long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
	
}
