#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, j;
  cin >> n >> j;
  if (n % 3 == 0 && j % 3 == 0 && j - n <= 3)
    cout << 3;
  else if (n == j)
    cout << n;
  else
    cout << 2;
  return 0;
}
