#include using namespace std; int main(){ int N, K; cin >> N >> K; cout << (N-1)/K/2*K << endl; }