#include <stdio.h>
#include <stdlib.h>  
#include <iostream>
#include <vector>
#include <string>
#include <algorithm> 
#include <map>

using namespace std;
//namaega184
//開催時間がきつい・・・
int main(){
	int n,k;scanf("%d%d",&n,&k);
	int a=(n+k-1)/k;  
	printf("%d\n",k*(a-(a+1)/2-(a%2?0:1)));
	return 0;
}