// AOJ 1295: Cubist Artwork
// 2017.10.16 bal4u@uu

#include <stdio.h>
#include <string.h>

int f[22];

int main()
{
	int w, d, h, ans;

	while (scanf("%d%d", &w, &d) && w > 0) {
		memset(f, 0, sizeof(f));
		ans = 0; while (w-- > 0) {
			scanf("%d", &h);
			ans += h, f[h]++;
		}
		while (d-- > 0) {
			scanf("%d", &h);
			if (f[h]) f[h]--;
			else ans += h;
		}
		printf("%d\n", ans);
	}
	return 0;
}