/*
AizuOnline A1295
Title Cubist Artwork
*/
#include <stdio.h>
#define max(x,y) (((x)>(y))?(x):(y))

//Global data section
int w,d;
int hist[21];
int hist2[21];
//
main()
{
        int i,j,x,sum;

        while(EOF!=scanf("%d %d",&w,&d) && (w || d))
        {
                for(i=1;i<=20;i++)
                        hist[i]=hist2[i]=0;

                for(i=0;i<w;i++)
                {
                        scanf("%d",&x);
                        hist[x]++;
                }
                for(i=0;i<d;i++)
                {
                        scanf("%d",&x);
                        hist2[x]++;
                }
                 
                sum=0;
                for(i=1;i<=20;i++)
                        sum += (i*max(hist[i],hist2[i]));
                printf("%d\n",sum);
        }
return(0);
}