#include <bits/stdc++.h>
using namespace std;
mt19937 rng(static_cast<unsigned int>(
    chrono::steady_clock::now().time_since_epoch().count()));
template <typename num_t>
inline void add_mod(num_t& a, const long long& b, const int& m) {
  a = (a + b) % m;
  if (a < 0) a += m;
}
template <typename num_t>
inline bool update_max(num_t& a, const num_t& b) {
  return a < b ? a = b, true : false;
}
template <typename num_t>
inline bool update_min(num_t& a, const num_t& b) {
  return a > b ? a = b, true : false;
}
template <typename num_t>
num_t gcd(const num_t& lhs, const num_t& rhs) {
  return !lhs ? rhs : gcd(rhs % lhs, lhs);
}
template <typename num_t>
num_t lcm(const num_t& lhs, const num_t& rhs) {
  return lhs / ::gcd(lhs, rhs) * rhs;
}
template <typename num_t>
num_t pw(num_t n, num_t k, const num_t& mod) {
  if (k == -1) k = mod - 2;
  num_t res = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) res = 1ll * res * n % mod;
    n = 1ll * n * n % mod;
  }
  return res % mod;
}
const int inf = 1e9 + 7;
const int mod = 998244353;
const long long ll_inf = (long long)inf * inf * 9 + 7;
const int maxn = 1000000 + 7;
int get_max(vector<int> a) {
  sort(a.begin(), a.end(), greater<int>());
  int sum = 0;
  for (int i = 0; i < (int)(a).size(); ++i) {
    sum += a[i];
    if (sum < 0) return i;
  }
  return (int)(a).size();
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(m, vector<int>(n, 0));
  for (auto& x : a) {
    for (auto& y : x) cin >> y;
  }
  pair<int, int> best = {0, 0};
  for (int i = 0; i + 1 < n; ++i) {
    vector<int> temp(m);
    for (int j = (0), _b = (m); j < _b; ++j) temp[j] = a[j][i] - a[j][n - 1];
    pair<int, int> cur = {get_max(temp), i};
    update_max(best, cur);
  }
  cout << m - best.first << '\n';
  vector<pair<int, int>> temp(m);
  for (int j = (0), _b = (m); j < _b; ++j)
    temp[j] = {a[j][best.second] - a[j][n - 1], j};
  sort(temp.begin(), temp.end());
  for (int i = (0), _b = (m - best.first); i < _b; ++i)
    cout << temp[i].second + 1 << ' ';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test) cin >> test;
  for (int i = 0; i < test; ++i) {
    solve();
  }
}
