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

using namespace std;

int main(void){
	int w, d, h[10], hd[10], i, b[20], c[20], e[20], ans;
	while(1){
		scanf("%d%d",&w,&d);
		if(w == 0 && d == 0) break;
		memset(b,0,sizeof(b));
		for(i = 0;i < w;i++){
			scanf("%d",&h[i]);
			b[h[i] - 1]++;
		}
		memset(c,0,sizeof(c));
		for(i = 0;i < d;i++){
			scanf("%d",&hd[i]);
			c[hd[i] - 1]++;
		}
		for(i = 0;i < 20;i++)
			e[i] = max(b[i],c[i]);
		ans = 0;
		for(i = 0;i < 20;i++)
			ans += e[i] * (i + 1);
		printf("%d\n",ans);
	}
	return 0;
}