#include <bits/stdc++.h>
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
void test_case() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> votes(m + 1, vector<int>(n + 1));
  vector<pair<int, int>> info;
  int tot_diff = 0;
  for (int i = 1; i <= m; ++i) {
    for (int j = 1; j <= n; ++j) {
      cin >> votes[i][j];
    }
  }
  vector<int> erased;
  bool vis = false;
  for (int o = 1; o < n; ++o) {
    vector<pair<int, int>> info;
    int tot_diff = 0;
    for (int c = 1; c <= m; ++c) {
      int diff = votes[c][n] - votes[c][o];
      tot_diff += diff;
      info.emplace_back(diff, c);
    }
    sort(info.rbegin(), info.rend());
    vector<int> cand;
    int ctr = 0;
    while (tot_diff > 0) {
      tot_diff -= info[ctr].first;
      cand.emplace_back(info[ctr].second);
      ++ctr;
    }
    if (!vis) {
      erased = cand;
      vis = true;
    } else {
      if ((int)cand.size() < (int)erased.size()) {
        erased = cand;
      }
    }
  }
  cout << erased.size() << "\n";
  for (auto &e : erased) {
    cout << e << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  test_case();
  return 0;
}
