#include using namespace std; using ll = long long; using P = pair; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main(){ int n,k; cin >> n >> k; if(k==n-1) cout << n << endl; else cout << n-1 << endl; return 0; }