#include using namespace std; int main(){ int n,m;cin>>n>>m; if(m == 1){ cout << 2 << endl; }else{ cout << n << endl; } }