#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n, m, id[N], ans[N];
int a[N][N], dif[N];
bool cmp(int x, int y) { return dif[x] < dif[y]; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(m); i++)
    for (int j = (int)(1); j <= (int)(n); j++) scanf("%d", &a[i][j]);
  for (int i = (int)(1); i <= (int)(m); i++) ans[++*ans] = i;
  for (int i = (int)(1); i <= (int)(m); i++) id[i] = i;
  for (int i = (int)(1); i <= (int)(n - 1); i++) {
    int S = 0;
    for (int j = (int)(1); j <= (int)(m); j++) dif[j] = a[j][i] - a[j][n];
    sort(id + 1, id + m + 1, cmp);
    for (int j = (int)(1); j <= (int)(m); j++) S += dif[j];
    for (int j = (int)(1); j <= (int)(m); j++) {
      if (S >= 0) {
        if (j - 1 <= *ans) {
          *ans = 0;
          for (int k = (int)(1); k <= (int)(j - 1); k++) ans[++*ans] = id[k];
        }
        break;
      }
      S -= dif[id[j]];
    }
  }
  printf("%d\n", *ans);
  for (int i = (int)(1); i <= (int)(*ans); i++) printf("%d ", ans[i]);
}
