#include <bits/stdc++.h>
using namespace std;
using u1 = bool;
using u8 = char;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
template <class T>
using V = vector<T>;
template <class T>
using Q = queue<T>;
template <class T>
using S = set<T>;
template <class K, class V>
using P = pair<K, V>;
template <class K, class V>
using M = map<K, V>;
template <class K, class V>
using UM = unordered_map<K, V>;
const i32 mod = 1e9 + 7;
int main() {
  i32 n, m;
  cin >> n >> m;
  V<V<i32>> v(m, V<i32>(n, 0));
  V<i32> sum(n, 0);
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> v[i][j];
      sum[j] += v[i][j];
    }
  }
  V<i32> ans(m + 1, -1);
  for (int i = 0; i < n - 1; i++) {
    i32 d = sum[i] - sum[n - 1];
    if (d >= 0) {
      ans = {};
      break;
    }
    V<P<i32, i32>> diff;
    for (int j = 0; j < m; ++j) {
      diff.emplace_back(v[j][i] - v[j][n - 1], j);
    }
    sort(diff.begin(), diff.end());
    V<i32> local_res;
    for (int j = 0; j < m && d < 0; ++j) {
      d -= diff[j].first;
      local_res.push_back(diff[j].second);
    }
    if (d >= 0 && local_res.size() < ans.size()) {
      ans = local_res;
    }
  }
  cout << ans.size() << endl;
  for (i32 c : ans) cout << c + 1 << " ";
  cout << endl;
  return 0;
}
namespace {
auto fast_io = [] {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  return 0;
}();
}
