#include using namespace std; #include using namespace atcoder; #define ALL(obj) (obj).begin(), (obj).end() #define rALL(obj) (obj).rbegin(), (obj).rend() using ll = long long; // cout << fixed << setprecision(10) int main() { int N, K; cin >> N >> K; int ans; if(N == K) ans = K-1; else ans = K+1; cout << ans << endl; return 0; }