#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main(){ int K, N; cin >> N >> K; if (N == 1 && K == 1) cout << 1 << endl; else if (K == N-1) cout << N << endl; else cout << N-1 << endl; return 0; }