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