#include using namespace std; int main() { int l , k; cin >> l >> k; cout << (l/2) - ((l/2)%k) << endl; return 0; }