#include <iostream>
#include <vector>
#include <algorithm>
#include <array>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int w, d;
    while (cin >> w >> d, w + d) {
        array<int, 25> W = {};
        array<int, 25> D = {};
        REP (i, 0, w) {
            int wi;
            cin >> wi;
            W[wi]++;
        }
        REP (i, 0, d) {
            int di;
            cin >> di;
            D[di]++;
        }
        int sum = 0;
        REP (i, 0, W.size()) {
            sum += i * max(W[i], D[i]);
        }
        cout << sum << endl;
    }
    return 0;
}