#include<stdio.h>
#include<cstring>
#include<iostream>
using namespace std;
// assuming maximum subscribers and books is 1000
int dp[1001][1001],pages[1001],n,m;
//dp[][] is memset to -1 from main
// Assuming books are numbered 1 to n
// change value of MAX based on your constraints
int MAX = 1000000000;
int rec(int position , int sub )
{
// These two are the base cases
if(position > n)
{
if(sub == 0)return 0;
return MAX;
}
if(sub == 0)
{
if(position > n)return 0;
return MAX;
}
// If answer is already computed for this state return it
if(dp[position][sub] != -1)return dp[position][sub];
int ans = MAX,i,sum = 0;
for(i = position; i <= n;i++)
{
sum += pages[i];
// taking the best of all possible solutions
ans = min(ans,max(sum,rec(i+1,sub-1)));
}
dp[position][sub]=ans;
return ans;
}
int main()
{
int test,i,start,ans,pos,sum;
cin >> test;
while(test -- )
{
cin >> n >> m;
memset(dp,-1,sizeof(dp));
for(i = 1;i <=n ;i++) cin >> pages[i];
// This is the minimized maximum number of
// pages any subscriber gets
cout << rec(1,m) <<endl;
// Now printing the assignment,
// basically the part you were looking for
// Once dp array is filled its easy to find an optimal assignment
start = 1;
while( start <= n )
{
ans = MAX,pos=-1,sum=0;
for(i = start; i <= n; i++)
{
sum += pages[i];
if(ans > max(sum ,rec(i+1,m-1)))
{
ans = max(sum,rec(i+1,m-1));
pos = i;
}
}
m--;
for(i = start;i <= pos;i++)cout << pages[i] << " ";
cout << " / ";
start = pos+1;
}
cout << endl;
}
return 0;
}