#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[m][n];
  vector<int> sum(n);
  int v = -1;
  for (int i = 0; i <= m - 1; i++) {
    for (int j = 0; j <= n - 1; j++) {
      cin >> a[i][j];
      sum[j] += a[i][j];
    }
  }
  for (int i = 0; i <= n - 2; i++) {
    v = max(v, sum[i]);
  }
  if (v >= sum[n - 1]) {
    cout << 0 << "\n";
    return 0;
  }
  int ans = 100000;
  int index = -1;
  for (int i = 0; i <= n - 2; i++) {
    vector<pair<int, int>> p(m);
    for (int j = 0; j <= m - 1; j++) {
      p[j] = {a[j][n - 1] - a[j][i], j};
    }
    sort(p.rbegin(), p.rend());
    int k = 0;
    int s1 = sum[i];
    int s2 = sum[n - 1];
    while (s1 < s2) {
      int i1 = p[k].second;
      s1 -= a[i1][i];
      s2 -= a[i1][n - 1];
      k++;
    }
    if (ans > k) {
      ans = k;
      index = i;
    }
  }
  cout << ans << "\n";
  vector<pair<int, int>> p(m);
  for (int j = 0; j <= m - 1; j++) {
    p[j] = {a[j][n - 1] - a[j][index], j};
  }
  sort(p.rbegin(), p.rend());
  int k = 0;
  int s1 = sum[index];
  int s2 = sum[n - 1];
  while (s1 < s2) {
    int i1 = p[k].second;
    s1 -= a[i1][index];
    s2 -= a[i1][n - 1];
    k++;
  }
  for (int q = 0; q <= k - 1; q++) {
    cout << p[q].second + 1 << " ";
  }
  cout << "\n";
}
