#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
using namespace std;

using ll = long long int;



long long int N, M;

int main() {

	cin >> N >> M;
	vector<vector<int>>v(N, vector<int>(M));
	for (auto &i : v) {
		for (auto &j : i)cin >> j;
	}
	vector<vector<int>>dis(N, vector<int>(M, 10000));
	vector<vector<vector<vector<int>>>>dp(M, vector<vector<vector<int>>>(N, vector<vector<int>>(M)));
	for (int i = M - 1; i >= 0; i--) {
		int mi = 100000;
		for (int j = 0; j < N; j++) {
			mi = min(mi, v[j][i]);
		}
		for (int j = 0; j < N; j++) {
			if (mi != v[j][i])continue;
			if (i == M - 1) {
				dp[i][j][0] = { j };
			}
			else {
				for (int k = 0; k < M; k++) {
					for (int l = 0; l < N; l++) {
						if (l != j) {
							if (k - 1 <0 || dp[i + 1][l][k - 1].empty())continue;
							if (dp[i][j][k].empty()) {
								dp[i][j][k] = { j };
								for (auto m : dp[i + 1][l][k - 1])dp[i][j][k].push_back(m);
							}
							else {
								vector<int>comp({ j });
								for (auto m : dp[i + 1][l][k - 1])comp.push_back(m);
								dp[i][j][k] = min(dp[i][j][k], comp);
							}
						}
						else {
							if (dp[i + 1][l][k].empty())continue;
							if (dp[i][j][k].empty()) {
								dp[i][j][k] = { j };
								for (auto m : dp[i + 1][l][k])dp[i][j][k].push_back(m);
							}
							else {
								vector<int>comp({ j });
								for (auto m : dp[i + 1][l][k])comp.push_back(m);
								dp[i][j][k] = min(dp[i][j][k], comp);
							}
						}
					}
				}
			}
		}
	}
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < M; k++) {
				if (dp[i][j][k].empty())continue;
//				cout << i << " " << j << " " << k << endl;
//				for (auto l : dp[i][j][k])cout << l << " ";
//				cout << endl;
			}
		}
	}
	int sum = 0;
	for (int i = 0; i < M; i++) {
		int add = 100000;
		for (int j = 0; j < N; j++) {
			add = min(add, v[j][i]);
		}
		sum += add;
	}
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < N; j++) {
			if (dp[0][j][i].empty())continue;
			cout << sum << " " << i << endl;
			for (auto k : dp[0][j][i])cout << k+1 << endl;
			return 0;
		}
	}
	return 0;
}

