#include<iostream>
#include<set>
#include<algorithm>
#include<numeric>
#include<iterator>

using namespace std;

int main(){
  for(int wd[2];cin>>wd[0]>>wd[1],wd[0];){
    multiset<int> ms[2];
    for(int i=0;i<2;i++){
      for(int j=0;j<wd[i];j++){
	int h;
	cin>>h;
	ms[i].insert(h);
      }
    }
    multiset<int> ans;
    set_union(begin(ms[0]),end(ms[0]),begin(ms[1]),end(ms[1]),inserter(ans,ans.begin()));
    cout<<accumulate(begin(ans),end(ans),0)<<endl;
  }
}

    