#include <iostream>
#include <map>
using namespace std;

int main(){
    int W,D;
    while(cin >> W >> D && W){
        map<int,int> F,S;
        int h,ans = 0;
        for(int i=1;i<=W;i++){
            cin >> h;
            ans += h;
            F[h]++;
        }
        for(int i=1;i<=D;i++){
            cin >> h;
            S[h]++;
        }
        for(auto x:S){
            if(F.count(x.first) && F[x.first]<x.second) ans += x.first*(x.second-F[x.first]);
            else if(!F.count(x.first)) ans += x.first*x.second;
        }
        cout << ans << endl;
    }
}
