#include using namespace std; typedef long long ll; #define pb push_back #define rep(i,n) for(int i=0;i<(n);++i) int main(){ cin.tie(0); ios::sync_with_stdio(false); int l,k;cin >> l >> k; int u=l/2; u/=k; if(u*k*2!=l) cout << u*k << endl; else cout << (u-1)*k << endl; }