inp = open("traffic.in", "r")

n, k = map(int, inp.readline().split())
nums = list(map(int, inp.readline().split()))

inp = open("traffic.out", "r")

res = int(inp.readline())
ki = list(map(int, inp.readline().split()))

res2 = 0
while (max(nums) > 0):
    for i in range(n):
        nums[i] = max(0, nums[i] - ki[i])
    add = 0
    for num in nums:
        for i in range(num):
            add += i
    res2 += add

print(res, res2)

assert(res == res2)