#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, minn = 109, cnt, j;
  int a[109][109];
  pair<int, int> pl[109][109];
  int v[109] = {0};
  vector<int> del, d;
  cin >> n >> m;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  for (int i = 1; i < n; i++)
    for (int j = 1; j <= m; j++) {
      pl[i][j].first = a[j][i] - a[j][n];
      pl[i][j].second = j;
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) v[i] += a[j][i];
  for (int i = 1; i < n; i++) v[i] = v[n] - v[i];
  for (int i = 1; i < n; i++) sort(pl[i] + 1, pl[i] + m + 1);
  for (int i = 1; i < n; i++) {
    cnt = 0;
    j = 1;
    del.clear();
    while (v[i] > 0 and j <= m) {
      v[i] += pl[i][j].first;
      cnt++;
      del.push_back(pl[i][j].second);
      j++;
    }
    if (minn > cnt) {
      minn = cnt;
      d = del;
    }
  }
  cout << minn << "\n";
  for (int x : d) cout << x << " ";
}
