#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int n, m;
int a[20], b[20];

int solve()
{
	rep(i, n) rep(j, m){
		if (a[i] == b[j]){
			b[j] = 0;
			break;
		}
	}
	
	int res = 0;
	rep(i, n) res += a[i];
	rep(i, m) res += b[i];
	
	return res;
}

int main()
{
	while (cin >> n >> m, n){
		rep(i, n) cin >> a[i];
		rep(i, m) cin >> b[i];
		cout << solve() << endl;
	}
}