#include int main(void) { int a, b; scanf("%d%d", &a, &b); printf("%d", a > b ? 1999999999 - b : b - 2); return 0; }