#include using namespace std; typedef unsigned long long ul; typedef signed long long ll; ul over = 1000000007; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cout << fixed; ll l, k; cin >> l >> k; ll c = (l-1)/(2*k); cout << c*k << endl; return 0; }