from collections import deque, Counter n, m = map(int, input().split()) aa = list(map(int,input().split())) bb = list(map(int,input().split())) aa = [a//100 for a in aa] aa.sort() cb = Counter(100-b for b in bb) if len(bb) < len(aa): cb[100] = len(aa)-len(bb) memo = [deque(maxlen=cb[v]) for v in range(101)] res = 0 for a in aa: for i,l in enumerate(memo): if l.maxlen == 0: continue if len(l) == l.maxlen: x = l.popleft() l.append(a) res += (a-x) * i a = x else: l.append(a) res += a*i break print(res)