#include using namespace std; typedef long long LL; int main() { // 1. 入力情報取得. LL L, K; cin >> L >> K; // 2. ユウちゃんが食べるポッキーの長さは? LL quote = L / (2 * K); LL ans = K * quote; if(quote * 2 * K == L) ans -= K; // 3. 後処理. cout << ans << endl; return 0; }