#include <stdio.h>
#include <memory.h>

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

#define MAXLEN 30

int main() {
    int w, d, h;
    int m[MAXLEN];
	while(scanf("%d%d",&w,&d), w+d) {
	    memset(m, 0, MAXLEN);
	    int ans = 0;
	    rep(i, w) {scanf("%d", &h); m[h]++; ans+=h;}
	    rep(j, d) {scanf("%d", &h); if(m[h]) m[h]--; else ans+=h;};
	    printf("%d\n", ans);
	}
}
