#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long extend_gcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1;
  long long d = extend_gcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return d;
}
long long rowNum[] = {-1, 0, 0, 1};
long long colNum[] = {0, -1, 1, 0};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  long long arr[m + 1][n + 1];
  memset(arr, 0, sizeof(arr));
  for (long long i = 0; i < m; i++) {
    for (long long j = 0; j < n; j++) cin >> arr[i][j];
  }
  long long res = 0;
  std::vector<bool> result(m, 0);
  for (long long i = 0; i < n - 1; i++) {
    std::vector<pair<long long, long long> > v;
    for (long long j = 0; j < m; j++) {
      v.push_back({arr[j][i] - arr[j][n - 1], j});
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    long long ans = 0, sum = 0;
    std::vector<bool> vis(m, 0);
    for (long long j = 0; j < m; j++) {
      sum += (v[j].first);
      if (sum >= 0) {
        ans++;
        vis[v[j].second] = 1;
      } else
        break;
    }
    if (res < ans) {
      res = ans;
      result = vis;
    }
  }
  cout << m - res << endl;
  for (long long i = 0; i < m; i++) {
    if (result[i] == 0) cout << i + 1 << " ";
  }
  cout << endl;
}
