#include <iostream>

using namespace std;

int w, d;
int cnt[25], cnt2[25];

int main(void)
{
  while(1){
    cin >> w >> d;
    if(w == 0 && d == 0) break;
    for(int i = 1; i < 25; i++) cnt[i] = cnt2[i] = 0;
    int sum = 0, h;
    for(int i = 0; i < w; i++){
      cin >> h;
      sum += h;
      cnt[h]++;
    }
    for(int i = 0; i < d; i++){
      cin >> h;
      sum += h;
      cnt2[h]++;
    }
    for(int i = 1; i < 25; i++) sum -= min(cnt[i], cnt2[i]) * i;
    cout << sum << endl;
  }
  return 0;
}

