#include <bits/stdc++.h> using namespace std; int main(){ int n,d; cin>>n>>d; int h=n%d; if(-h>d-h) cout<<n+d-h; else cout<<n-h; return 0; }