func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   T mceil(T a, T b) {     if (a % b == 0)       return a / b;     else       return a / b + 1;   }   const long long int M = 1e9 + 7;   const long long int N = 2e5 + 5;   const long long int inf = 9e18;   int main() {     ios_base ::sync_with_stdio(false);     cin.tie(NULL);     long long int n, m;     cin >> n >> m;     vector<long long int> a(n), b(m);     map<long long int, long long int> mp;     vector<pair<long long int, long long int> > v;     long long int am = -1;     long long int ans = 0;     for (long long int i = 0; i < n; i++) {       cin >> a[i];       am = max(a[i], am);       ans += a[i] * m;       v.push_back({a[i], m - 1});     }     for (long long int i = 0; i < m; i++) cin >> b[i];     sort((v).rbegin(), (v).rend());     vector<long long int> g;     for (long long int i = 0; i < m; i++) {       if (b[i] < am) {         cout << -1 <<   n ;         return 0;       } else if (b[i] == am)         continue;       else {         g.push_back(b[i]);       }     }     sort((g).rbegin(), (g).rend());     long long int ind = 0;     for (long long int i = 0; i < (int)((g).size()); i++) {       if (ind < n and v[ind].second) {         ans += g[i] - v[ind].first;         v[ind].second--;         if (v[ind].second == 0) ind++;       } else {         cout << -1;         return 0;       }     }     cout << ans;   }   