#include <bits/stdc++.h>
using namespace std;
int main() {
  int l, r;
  cin >> l >> r;
  int maxi = 0, ind = 2;
  bool d = false;
  if (r == l) {
    cout << r;
    return 0;
  }
  for (int j = 2; j <= l; j++) {
    if ((r / j) - ((l - 1) / j) > maxi) {
      maxi = (r / j) - ((l - 1) / j);
      ind = j;
      d = true;
    } else if (d)
      break;
  }
  cout << ind;
}
