#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int i, j, k;
void solve() {
  int l, r, x = 0, y = 0;
  cin >> l >> r;
  if (l == r)
    cout << l << "\n";
  else
    cout << 2 << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
