#include <stdio.h>
#include <stdlib.h>
void swap(int *num, int *num2);
void bubbleSort(int a[], int lo, int hi);
void sort(int array[], int newer[], int size);
int main(void) {
int *smaller_array, *larger_array;
int bob_item_count, sue_item_count, smaller_array_size, larger_array_size;
scanf("%d %d", &bob_item_count, &sue_item_count);
int bob[bob_item_count];
int sue[sue_item_count];
int counter = 0;
while (counter < bob_item_count) {
scanf("%d", &bob[counter]);
counter++;
}
counter = 0;
while (counter < sue_item_count) {
scanf("%d", &sue[counter]);
counter++;
}
if (bob_item_count < sue_item_count) {
smaller_array = bob;
larger_array = sue;
smaller_array_size = bob_item_count;
larger_array_size = sue_item_count;
} else {
smaller_array = sue;
larger_array = bob;
smaller_array_size = sue_item_count;
larger_array_size = bob_item_count;
}
int total_price = 0;
counter = 0;
while (counter < smaller_array_size) {
total_price += smaller_array[counter];
counter++;
}
counter = 0;
while (counter < smaller_array_size) {
int curr_max = -1;
int max_index = -1;
int index = 0;
while (index < larger_array_size) {
if (larger_array[index] > curr_max) {
curr_max = larger_array[index];
max_index = index;
}
index++;
}
larger_array[max_index] = -1;
total_price += curr_max;
counter++;
}
printf("%d", total_price);
return 0;
}