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