#include <bits/stdc++.h>
using namespace std;
int read() {
  int num = 0, f = 1;
  char s = getchar();
  while (s > '9' or s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' and s <= '9') {
    num = num * 10 + (s - '0');
    s = getchar();
  }
  return num * f;
}
int n, m;
int a[110][110];
int b[110][110];
struct zw {
  int cha;
  int index;
} ans[110][110];
int sum[110];
int u[110];
bool cmp(struct zw a, struct zw b) { return a.cha > b.cha; }
int main() {
  cin >> n >> m;
  for (int j = 1; j <= m; j++)
    for (int i = 1; i <= n; i++) {
      a[i][j] = read();
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      ans[i][j].cha = a[n][j] - a[i][j];
      sum[i] += a[i][j];
      ans[i][j].index = j;
    }
  for (int i = 1; i <= n - 1; i++) {
    int index = 0;
    int num = 0;
    sort(ans[i] + 1, ans[i] + 1 + m, cmp);
    int cha = sum[n] - sum[i];
    for (int j = 1; j <= m; j++) {
      if (cha <= 0)
        break;
      else {
        cha -= ans[i][j].cha;
        b[i][++index] = ans[i][j].index;
        b[i][0] = index;
      }
    }
  }
  int flag = n + 1;
  int ks = 0;
  for (int i = 1; i <= n - 1; i++) {
    if (b[i][0] < flag) flag = b[i][0], ks = i;
  }
  cout << b[ks][0] << endl;
  for (int i = 1; i <= b[ks][0]; i++) cout << b[ks][i] << " ";
  return 0;
}
