#include <bits/stdc++.h>
#pragma GCC optimize "Ofast,omit-frame-pointer,inline"
using namespace std;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1 << 29;
const long long INFL = 1LL << 60;
const long long mod = 998244353;
int n, m;
vector<vector<int>> v;
vector<int> solve(int i, int j) {
  int sum = 0;
  vector<int> a;
  vector<pair<int, int>> p;
  for (int k = 0; k < int(m); k++) {
    p.push_back({v[k][i] - v[k][j], k});
    sum += v[k][i] - v[k][j];
  }
  sort((p).begin(), (p).end());
  int k = 0;
  while (sum < 0) {
    sum -= p[k].first;
    a.push_back(p[k].second);
    k++;
  }
  return a;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  v.resize(m);
  for (int i = 0; i < int(m); i++) v[i].resize(n);
  for (int i = 0; i < int(m); i++)
    for (int j = 0; j < int(n); j++) cin >> v[i][j];
  vector<vector<int>> ans(n);
  vector<int> cn(n, 10000);
  for (int i = 0; i < int(n); i++) {
    int cnt = 0;
    vector<int> a;
    for (int j = 0; j < int(n); j++) {
      if (i == j) continue;
      vector<int> tmp = solve(i, j);
      if (cn[j] > tmp.size()) {
        cn[j] = tmp.size();
        ans[j] = tmp;
      }
    }
  }
  int cnt = 0;
  vector<int> res;
  for (int i = 0; i < int(n); i++) {
    if (cnt <= cn[i]) {
      cnt = cn[i];
      res = ans[i];
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < int(cnt); i++) cout << res[i] + 1 << ' ';
}
