#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long int ll; //#include using namespace std; int main() { int Q; Q = 1; //cin >> Q; while (Q--) { ll n; ll m; cin >> n >> m; ll r = n / 2; r /= m; if (n % 2 == 0)r--; r = max(r, (ll)0); cout << r * m; } return 0; }