/** * @FileName a.cpp * @Author kanpurin * @Created 2021.11.19 23:58:46 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n,k;cin >> n >> k; if (n == 1 && k == 1) { cout << 1 << endl; } else if (n == k) { cout << n-1 << endl; } else if (n-1 == k) { cout << n << endl; } else { cout << n-1 << endl; } return 0; }