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