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