{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"有一个不递减的序列,现在要把这些数分成若干个部分,每部分不能少于m个数。每部分的权值为所有数减去该部分最小的数的和。"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\u003cdiv\u003e\u003cp\u003eThe first line of the input file contains a single integer \u003ci\u003eT\u003c/i\u003e (1 ≤ \u003ci\u003eT\u003c/i\u003e ≤ 20) – the number of tests in the input file. Each test starts with a line containing two numbers \u003ci\u003en\u003c/i\u003e (2 ≤ \u003ci\u003en\u003c/i\u003e ≤ 500000) – the amount of numbers in the sequence and \u003ci\u003ek\u003c/i\u003e (2 ≤ \u003ci\u003ek\u003c/i\u003e ≤ \u003ci\u003en\u003c/i\u003e). It is followed by a line with \u003ci\u003en\u003c/i\u003e integer numbers—the degree sequence in ascending order. And every number s in the sequence is in the range [0, 500000]. \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\u003cp\u003eFor each test, output one line containing a single integer—the minimal cost.\u003c/p\u003e\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e2\n7 3\n2 2 3 4 4 5 5\n6 2\n0 3 3 4 8 9\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e3\n5\n\u003c/pre\u003e"}}]}