#include <bits/stdc++.h>
using namespace std;
vector<long long int> poll[105];
long long int n, m;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.first > b.first; }
void solve() {
  cin >> n >> m;
  for (__typeof(m) i = (0) - ((0) > (m)); i != (m) - ((0) > (m));
       i += 1 - 2 * ((0) > (m))) {
    for (__typeof(n) j = (0) - ((0) > (n)); j != (n) - ((0) > (n));
         j += 1 - 2 * ((0) > (n))) {
      long long int temp;
      cin >> temp;
      poll[i].emplace_back(temp);
    }
  }
  vector<long long int> ans;
  for (int i = 0; i < m; i++) {
    ans.emplace_back(i);
  }
  for (int i = 0; i < n - 1; i++) {
    vector<pair<int, int>> by;
    long long int sum = 0;
    for (int j = 0; j < m; j++) {
      sum += (poll[j][n - 1] - poll[j][i]);
      by.emplace_back(poll[j][n - 1] - poll[j][i], j);
    }
    sort(by.begin(), by.end(), cmp);
    int j = 0;
    while (j < m && sum > 0) {
      sum -= (by[j].first);
      j++;
    }
    if (j < ans.size()) {
      ans.clear();
      for (int k = 0; k < j; k++) {
        ans.emplace_back(by[k].second);
      }
    }
  }
  cout << ans.size() << endl;
  for (auto x : ans) {
    cout << x + 1 << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
