#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int w, d;
	while (cin >> w >> d, w, d) {
		int a1[22] = {}, a2[22] = {};
		for (int i = 0; i < w; i++) { int k; cin >> k; a1[k]++; }
		for (int i = 0; i < d; i++) { int k; cin >> k; a2[k]++; }
		int ans = 0;
		for (int i = 1; i <= 20; i++)
			ans += max(a1[i], a2[i])*i;
		cout << ans << endl;
	}
}