#include using namespace std; int main(){ int a,b,c; cin >> a >> b; if(b==0||a=b&&(a+1)/b!=2) c=2; else c=1; } else c=2; cout << a-c << endl; return 0; }