#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long 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 g = gcd(b, a % b, x1, y1);
  x = y1;
  y1 = x1 - y1 * (a / b);
  return g;
}
long long qpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n % 2) {
      res = (res * a) % MOD;
      n--;
    } else {
      n = n / 2;
      a = (a * a) % MOD;
    }
  }
  return res;
}
long long inv(long long a) { return qpow(a, MOD - 2); }
bool cmp(pair<long long, long long> &p1, pair<long long, long long> &p2) {
  if (p1.first != p2.first) return p1.first < p2.first;
  return p1.second < p2.second;
}
bool prime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> arr(m, vector<int>(n));
  vector<pair<int, int>> v(m);
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) cin >> arr[i][j];
  }
  int ans = n + 1;
  vector<int> p;
  for (int i = 0; i < n - 1; i++) {
    vector<pair<int, int>> v(m);
    for (int j = 0; j < m; j++)
      v[j].first = arr[j][i] - arr[j][n - 1], v[j].second = j;
    sort(v.begin(), v.end(), greater<pair<int, int>>());
    int j = 0;
    int res = 0;
    while (j < m && res + v[j].first >= 0) {
      res += v[j].first;
      j++;
    }
    if (m - j < ans) {
      ans = m - j;
      p.clear();
      for (int b = j; b < m; b++) p.push_back(v[b].second);
    }
  }
  cout << p.size() << '\n';
  for (int i = 0; i < p.size(); i++) cout << p[i] + 1 << " ";
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  cerr << "Time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << '\n';
  return 0;
}
