#include <bits/stdc++.h>
using namespace std;
int get_i(int sum[][105], int m, int j) {
  int i, k = -8527, l, u;
  for (i = 0; i < m; i++) {
    l = k;
    k = max(k, sum[i][j]);
    if (l != k) u = i;
  }
  sum[u][j] = -7894;
  return u;
}
void nskh(int csumn[], int sumn[], int n) {
  for (int i = 0; i < n; i++) csumn[i] = sumn[i];
}
int main() {
  queue<int> q, q12;
  int arr[105][105], sum[105][105], sumn[105];
  int n, m, i, j, *y, u;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      cin >> arr[i][j];
      sumn[j] += arr[i][j];
    }
    for (j = 0; j < n - 1; j++) {
      sum[i][j] = arr[i][n - 1] - arr[i][j];
    }
  }
  int csumn[105];
  for (j = 0; j < n - 1; j++) {
    nskh(csumn, sumn, n);
    y = max_element(csumn, csumn + n - 1);
    while (csumn[n - 1] > *y) {
      i = get_i(sum, m, j);
      for (u = 0; u < n; u++) {
        csumn[u] -= arr[i][u];
      }
      q.push(i);
      y = max_element(csumn, csumn + n - 1);
    }
    if (j == 0 || q12.size() > q.size()) q12 = q;
    while (!q.empty()) {
      q.pop();
    }
  }
  cout << q12.size() << endl;
  while (!q12.empty()) {
    cout << q12.front() + 1 << " ";
    q12.pop();
  }
  return 0;
}
