## https://yukicoder.me/problems/no/2770 from collections import deque class Queue: def __init__(self, b, size): self.b = b self.size = size self.queue = deque() self.value_sum = 0 def append(self, a): self.queue.append(a) self.value_sum += a if len(self.queue) > self.size: c = self.queue.popleft() self.value_sum -= c return c else: return None def sum(self): v = self.value_sum // 100 return v * (100 - self.b) def main(): N, M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) # Aを安い順番にソート A.sort() b_map = {} for b in B: if b not in b_map: b_map[b] = 0 b_map[b] += 1 b_array = [(b, count) for b, count in b_map.items()] b_array.sort(key=lambda x : x[0], reverse=True) b_queue = [Queue(b, count) for b, count in b_array] b_queue.append(Queue(0, N)) for k in range(N): a = A[k] for i in range(len(b_queue)): a = b_queue[i].append(a) if a is None: break ans = 0 for i in range(len(b_queue)): ans += b_queue[i].sum() print(ans) if __name__ == '__main__': main()