#include <bits/stdc++.h>
using namespace std;
int a[101][101], newcnt[101];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) cin >> a[i][j];
  }
  int ans = 0;
  bitset<101> T;
  for (int i = 0; i < n - 1; i++) {
    int cnt[n];
    for (int j = 0; j < n; j++) cnt[j] = 0;
    bitset<101> S;
    bitset<101> Q;
    int tmp = 0;
    for (int k = 0; k < m; k++) {
      int temp = -1e9, F = -1;
      for (int j = 0; j < m; j++) {
        if (S[j]) continue;
        for (int l = 0; l < n; l++) newcnt[l] = cnt[l] + a[j][l];
        int newtemp =
            newcnt[i] - max(*max_element(newcnt, newcnt + i),
                            *max_element(newcnt + i + 1, newcnt + 101));
        if (newtemp > temp) {
          temp = newtemp;
          F = j;
        }
      }
      if (temp >= 0) {
        tmp = temp;
        Q = S;
        Q[F] = 1;
      }
      S[F] = 1;
      for (int l = 0; l < n; l++) cnt[l] += a[F][l];
    }
    ans = max(ans, (int)Q.count());
    if (ans == Q.count()) T = Q;
  }
  cout << m - ans << '\n';
  for (int i = 0; i < m; i++)
    if (!T[i]) cout << i + 1 << ' ';
}
