#include <bits/stdc++.h>
int dr[] = {2, 2, -2, -2, 1, -1, 1, -1};
int dc[] = {1, -1, 1, -1, 2, 2, -2, -2};
int dr1[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dc1[] = {-1, 1, -1, 0, 1, -1, 0, 1};
int dr2[] = {-1, -1, -1};
int dc2[] = {-1, 1, 0};
using namespace std;
long long int a[102][102], b[102];
int main() {
  long long int i, j, n, m;
  while (cin >> n >> m) {
    for (i = 1; i <= m; i++) {
      for (j = 1; j <= n; j++) cin >> a[i][j];
    }
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) b[i] += a[j][i];
    }
    long long int min1 = 1000000000000, sta = 0;
    vector<long long int> v;
    for (i = 1; i < n; i++) {
      priority_queue<pair<long long int, long long int> > pq;
      long long int d = b[i] - b[n];
      for (j = 1; j <= m; j++) {
        long long int d = a[j][n] - a[j][i];
        pq.push(make_pair(d, j));
      }
      long long int cn = 0;
      vector<long long int> v1;
      while (pq.size() > 0) {
        if (d >= 0) break;
        cn++;
        d += pq.top().first;
        long long int x = pq.top().second;
        pq.pop();
        v1.push_back(x);
      }
      if (cn < min1) {
        v.clear();
        min1 = cn;
        sta = i;
        v = v1;
      }
    }
    cout << min1 << endl;
    for (i = 0; i < v.size(); i++) cout << v[i] << " ";
    if (min1 > 0) cout << endl;
  }
  return 0;
}
