#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e6 + 100;
const int Base = 337;
const int MOD = 1e9 + 9;
void doc() {
  freopen(
      "OB"
      ".inp",
      "r", stdin);
  freopen(
      "OB"
      ".out",
      "w", stdout);
}
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
int c[200][200];
int cc, m;
bool cmp(int x, int y) { return c[x][m] - c[x][cc] > c[y][m] - c[y][cc]; }
void solve() {
  int n;
  cin >> m >> n;
  int a[m + 1];
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> c[i][j];
      a[j] += c[i][j];
    }
  }
  if (a[m] <= *max_element(a + 1, a + m)) {
    cout << 0 << '\n';
    return;
  }
  vector<int> Res;
  for (int i = 1; i <= n; i++) Res.push_back(i);
  for (int j = 2; j < m; j++) {
    int H[n + 1];
    for (int i = 1; i <= n; i++) H[i] = i;
    cc = j;
    sort(H + 1, H + 1 + n, cmp);
    int x = a[m], y = a[j];
    for (int i = 1; i <= n; i++) {
      int I = H[i];
      x -= c[I][m];
      y -= c[I][j];
      if (x <= y) {
        if (i < (int)Res.size()) {
          Res.resize(i);
          for (int k = 0; k < i; k++) Res[k] = H[k + 1];
        }
        break;
      }
    }
  }
  cout << (int)Res.size() << '\n';
  for (int x : Res) cout << x << ' ';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
}
