#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n,m; cin>>n>>m; vector A(n),B(m); rep(i,n) cin>>A[i]; rep(i,m) cin>>B[i]; vector C; rep(i,m){ if(B[i]>A[0] && B[i]A[n-1]) ans+=B[m-1]-A[n-1]; vector> P; rep(i,n) P.push_back({A[i],0}); rep(i,l) P.push_back({C[i],1}); sort(ALL(P)); ll p=P.size(); ll pre=P[0].first,ma=0; for(int i=1;i