{"trustable":true,"sections":[{"title":"Background","value":{"format":"MD","content":"The legendary cow V God of the computer competition team has finally finished the college entrance examination, but as the monitor, he cannot relax yet. The head teacher, Old T, has given him a daunting task: to help classmates find the most reasonable university application plan. However, V God is too busy, with a group of girls waiting behind him for a date. So he thought of you, also a member of the computer competition team, and asked you to help him complete this daunting task."}},{"title":"Description","value":{"format":"MD","content":"There are $m$ schools in total, each with an expected admission score of $a_i$. There are $n$ students, and their estimated scores are $b_i$.\n\nBased on the estimated scores of $n$ students, recommend a school to each student, requiring the difference between the expected admission score of the school and the estimated score of the student to be minimized (it can be higher or lower, after all, it\u0027s just an estimate). This minimum value is the dissatisfaction. Find the minimum sum of dissatisfactions for all students."}},{"title":"Input","value":{"format":"MD","content":"The first line contains two integers $m,n$. $m$ represents the number of schools, and $n$ represents the number of students.\n\nThe second line contains $m$ numbers, representing the expected admission scores of $m$ schools. The third line contains $n$ numbers, representing the estimated scores of $n$ students."}},{"title":"Output","value":{"format":"MD","content":"Output a single line, which is the minimum sum of dissatisfactions."}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 3\n513 598 567 689\n500 600 550\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e32\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"Hint","value":{"format":"MD","content":"Constraints:\n\nFor $30\\%$ data, $1\\leq n,m\\leq1000$, estimated scores and admission scores are $\\leq10000$;\n\nFor $100\\%$ data, $1\\leq n,m\\leq100000$, estimated scores and admission scores are $\\leq 1000000$ and are non-negative integers."}}]}