#include <bits/stdc++.h>   using namespace std;   const long long mxn = 5e5 + 123;   const long long inf = 1e9;   const long long mod = 998244353;   bool om[mxn];   vector<long long> v;   long long n, mn = 1e18;   ;   int main() {     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; i++)       if (n % i == 0) v.push_back(i);     for (int i = 0; i < v.size(); i++) {       if (n / v[i] < m) mn = min(mn, (v[i] * m) + (n / v[i]));     }     cout << mn;     return 0;   }   