{"raw_statement":[{"iden":"problem statement","content":"There are $N$ children in a kindergarten. The height of the $i$\\-th child is $H_i$. Here, $N$ is an odd number.\nYou, the teacher, and these children - $N+1$ people in total - will make $\\large\\frac{N+1}2$ pairs.\nYour objective is to minimize the sum of the differences in height over those pairs. That is, you want to minimize $\\displaystyle \\sum_{i=1}^{(N+1)/2}|x_i-y_i|$, where $(x_i, y_i)$ is the pair of heights of people in the $i$\\-th pair.\nYou have $M$ forms that you can transform into. Your height in the $i$\\-th form is $W_i$.\nFind the minimum possible sum of the differences in height over all pairs, achieved by optimally choosing your form and making pairs."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $1 \\leq N, M \\leq 2 \\times 10^5$\n*   $N$ is an odd number.\n*   $1 \\leq H_i \\leq 10^9$\n*   $1 \\leq W_i \\leq 10^9$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$\n$H_1$ $\\dots$ $H_N$\n$W_1$ $\\dots$ $W_M$"},{"iden":"sample input 1","content":"5 3\n1 2 3 4 7\n1 3 8"},{"iden":"sample output 1","content":"3\n\nThe minimum is minimized by choosing the form with the height $8$ and making pairs with heights $(1, 2)$, $(3, 4)$, and $(7, 8)$."},{"iden":"sample input 2","content":"7 7\n31 60 84 23 16 13 32\n96 80 73 76 87 57 29"},{"iden":"sample output 2","content":"34"},{"iden":"sample input 3","content":"15 10\n554 525 541 814 661 279 668 360 382 175 833 783 688 793 736\n496 732 455 306 189 207 976 73 567 759"},{"iden":"sample output 3","content":"239"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}