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