#include <bits/stdc++.h>
using namespace std;
void fast() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int a, b, c, d, i, j, sum = 0, cnt = 0;
  cin >> a >> b;
  if (a == b) {
    if (a % 2 == 0) {
      cout << 2 << endl;
    } else {
      cout << a << endl;
    }
  } else {
    cout << 2 << endl;
  }
}
