/*
 * 2517.cc: Hotel
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 50;
const int MAX_D = 50;

const int INF = 1 << 30;

/* typedef */

typedef vector<int> vi;

/* global variables */

int ps[MAX_N][MAX_D];
int dp0[MAX_D][MAX_N], dp1[MAX_D][MAX_N];
vi dpv[MAX_D][MAX_N];

/* subroutines */

/* main */

int main() {
  int n, d;
  cin >> n >> d;

  for (int i = 0; i < n; i++)
    for (int j = 0; j < d; j++) cin >> ps[i][j];

  for (int j = 0; j < n; j++)
    dp0[0][j] = ps[j][0], dp1[0][j] = 0, dpv[0][j].push_back(j);
  for (int i = 1; i < d; i++)
    for (int j = 0; j < n; j++)
      dp0[i][j] = dp1[i][j] = INF;

  for (int i = 0; i < d - 1; i++)
    for (int j = 0; j < n; j++) {
      int &cd0 = dp0[i][j], &cd1 = dp1[i][j];
      for (int k = 0; k < n; k++) {
	int nd0 = cd0 + ps[k][i + 1];
	int nd1 = (j != k) ? cd1 + 1 : cd1;

	if (dp0[i + 1][k] > nd0 ||
	    (dp0[i + 1][k] == nd0 &&
	     (dp1[i + 1][k] > nd1 ||
	      (dp1[i + 1][k] == nd1 && dpv[i + 1][k] > dpv[i][j])))) {
	  dp0[i + 1][k] = nd0;
	  dp1[i + 1][k] = nd1;
	  dpv[i + 1][k] = dpv[i][j];
	  dpv[i + 1][k].push_back(k);
	}
      }
    }

  int mindp0 = INF, mindp1 = INF;
  vi minv(d, INF);
  for (int j = 0; j < n; j++)
    if (mindp0 > dp0[d - 1][j] ||
	(mindp0 == dp0[d - 1][j] &&
	 (mindp1 > dp1[d - 1][j] ||
	  (mindp1 == dp1[d - 1][j] && minv > dpv[d - 1][j]))))
      mindp0 = dp0[d - 1][j], mindp1 = dp1[d - 1][j], minv = dpv[d - 1][j];

  printf("%d %d\n", mindp0, mindp1);
  for (int i = 0; i < d; i++) printf("%d\n", minv[i] + 1);
  return 0;
}