#include <cstdio>

#define task_id "pizza"

using namespace std;

int main()
{
    if (task_id != "") {
        freopen(task_id ".in", "rt", stdin);
        freopen(task_id ".out", "wt", stdout);
    }
    int k, m, res;
    scanf("%d%d", &k, &m);
    if (k == 1) {
        res = 0;
    } else {
        res = (m > k) ? k : m;
    }
    printf("%d", res);

    return 0;
}
