Smallest element of array B should be greater than or equal to Largest of array A. This can be done by reducing any element of A by 1 or increasing any element of B by 1, can be done multiple times. Output the minimum cost of operations. cost of each operation is 1.
A: 1 3 5
B: 4 7
Output : 1
A: 5 8 9 11
B: 1 3 4
Output : 20