#include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
using namespace std;
struct data {
  int a, b, indx;
};
bool cmp(data x, data y) {
  if (x.a - x.b < y.a - y.b) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  std::vector<vector<int> > v(m);
  for (int i = 0; i < m; i++) {
    v[i].resize(n);
    for (int j = 0; j < n; j++) cin >> v[i][j];
  }
  int cnt = m;
  std::vector<int> indx;
  for (int i = 0; i < n - 1; i++) {
    std::vector<data> arr(m);
    for (int j = 0; j < m; j++) {
      arr[j].a = v[j][i];
      arr[j].b = v[j][n - 1];
      arr[j].indx = j;
    }
    sort(arr.begin(), arr.end(), cmp);
    int tmpCnt = 0, suma = 0, sumb = 0;
    std::vector<int> tmpIndx;
    for (int j = 0; j < m; j++) {
      suma += arr[j].a;
      sumb += arr[j].b;
    }
    int k = 0;
    while (suma < sumb) {
      tmpCnt++;
      suma = suma - arr[k].a;
      sumb = sumb - arr[k].b;
      tmpIndx.push_back(arr[k].indx);
      k++;
    }
    if (tmpCnt < cnt) {
      cnt = tmpCnt;
      indx = tmpIndx;
    }
  }
  cout << cnt << '\n';
  if (cnt == m) {
    for (int i = 1; i <= m; i++) cout << i << " ";
    return 0;
  }
  for (auto x : indx) cout << x + 1 << " ";
  return 0;
}
