链接:
/*
《算法竞赛入门经典-训练指南》 第一章 例题1
排序+贪心
by shuangde
*/
#include<cstdio>
#include<algorithm>
#define REP(i, n) for(int i=0; i<(n); ++i)
using namespace std;
const int MAXN = 20005;
int dia[MAXN], cost[MAXN];
int main(){
int n, m;
while(~scanf("%d%d",&n,&m) && n+m){
REP(i, n) scanf("%d", &dia[i]);
REP(i, m) scanf("%d", &cost[i]);
sort(dia, dia+n);
sort(cost, cost+m);
int ans=0, cur=0;
REP(i, m) {
if(dia[cur]<=cost[i]){
ans += cost[i];
++cur;
}
if(cur == n) break;
}
if(cur == n){
printf("%d\n", ans);
}
else{
puts("Loowater is doomed!");
}
}
return 0;
}