#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
const int N = 3e3 + 3;
int a[N][N];
pii sum[N];
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) cin >> a[i][j];
  }
  vector<int> res;
  int mn = 1e9;
  for (int i = 0; i < n - 1; i++) {
    vector<pii> ve;
    int sum = 0;
    for (int j = 0; j < m; j++) {
      sum += a[j][i] - a[j][n - 1];
      ve.push_back({a[j][i] - a[j][n - 1], j});
    }
    sort(ve.begin(), ve.end());
    vector<int> cur;
    for (int i = 0; i < m; i++) {
      if (sum >= 0) break;
      sum -= ve[i].first;
      cur.push_back(ve[i].second);
    }
    if (cur.size() < mn) {
      mn = cur.size();
      res = cur;
    }
  }
  cout << res.size() << "\n";
  for (auto x : res) cout << ++x << " ";
  cout << "\n";
  return 0;
}
