#include #include #include using namespace std; using namespace atcoder; #define rep(i, l, n) for (int i = (l); i < (n); i++) #define max(p, q) ((p) > (q) ? (p) : (q)) #define min(p, q) ((p) < (q) ? (p) : (q)) #define all(x) x.begin(), x.end() #define fi first #define se second #define lb lower_bound; #define ub upper_bound; #define lbi(A, x) (ll)(lb(all(A), x) - A.begin()) #define ubi(A, x) (ll)(ub(all(A), x) - A.begin()) using ll = long long; using P = pair; template using V = vector; template using VV = V >; template const ll INF = 1000000000000000001; const int inf = 1001001001; const ll mod = 1000000007; const ll MOD = 998244353; inline V dtois(string& s) { V vec = {}; for (auto& e : s) { vec.push_back(e - '0'); } return vec; } int main(void) { int N, K; cin >> N >> K; if (N == 1) { cout << 1 << endl; } else if (K == N - 1) { cout << N << endl; } else { cout << N - 1 << endl; } return 0; }