/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com5
 * Date: 2013.10.04
 *
 * Status: Accepted, Time = 0.6
 */

import java.util.*;
import java.io.*;
import java.math.*;

public class subset_sk_n2logn_double_precise {

	int n, d;
	final double eps = 1e-11;

	public class Vec implements Comparable<Vec> {
		double v[];
		int ind;

		public int compareTo( Vec x ) {
			for (int i = 0; i < d; i++) {
				if (Math.abs(v[i]) < eps) {
					if (Math.abs(v[i] - x.v[i]) > eps) {
						return v[i] < x.v[i] ? -1 : 1;
					}
				} else {
					if (Math.abs(x.v[i] / v[i] - 1) > eps) {
						return ((x.v[i] / v[i] > 1) ^ (v[i] < 0)) ? -1 : 1;
					}
				}
			}
			return 0;
		}
	}

	StreamTokenizer in;
	PrintWriter out;
	
	int nextInt() throws IOException {
		in.nextToken();
		return (int)in.nval;
	}

	public void run() throws IOException {
		final String NAME = "subset";
		in = new StreamTokenizer(new BufferedReader(new FileReader(NAME + ".in")));
		PrintWriter out = new PrintWriter(new File(NAME + ".out"));

		n = nextInt();
		d = nextInt();
		
		int a[][] = new int[n][d];
		double b[] = new double[d];
		Vec c[] = new Vec[n];
		int cn, pn, p[] = new int[n];
		int rn = 0, rp[] = new int[n];

		for (int i = 0; i < n; i++) {
			c[i] = new Vec();
			c[i].v = new double[d];
			for (int j = 0; j < d; j++) {
				a[i][j] = nextInt();
			}
		}
		for (int i = 0; i < n; i++) {
			pn = cn = 0;

			int pos = 0;
			while (a[i][pos] == 0) {
				pos++;
			}
			for (int j = 0; j < i; j++) {
				int good = 1;
				for (int k = 0; k < d; k++) {
					b[k] = a[j][k];
				}
				if (a[j][pos] != 0) {
					double koef = (double)a[j][pos] / a[i][pos];
					good = 0;
					for (int k = 0; k < d; k++) {
						if (eps < Math.abs(b[k] -= koef * a[i][k])) {
							good = 1;
						}
					}
				}
				if (good == 0) {
					p[pn++] = j;
				} else {
					int id = 0;
					while (eps > Math.abs(b[id])) {
						id++;
					}
					double koef = 1.0 / b[id];
					for (int k = 0; k < d; k++) {
						c[cn].v[k] = b[k] * koef;
					}
					c[cn++].ind = j;
				}
			}
			Arrays.sort(c, 0, cn);

			int ma = 0, rj = 0;
			for (int j = 0, k; j < cn; j = k) {
				for (k = j + 1; k < cn && c[j].compareTo(c[k]) == 0; k++)
					;
				if (k - j > ma) {
					ma = k - j;
					rj = j;
				}
			}
			if (ma + pn + 1 > rn) {
				rn = ma + pn + 1;
				for (int j = 0; j < pn; j++) {
					rp[j] = p[j];
				}
				for (int j = 0; j < ma; j++) {
					rp[j + pn] = c[rj + j].ind;
				}
				rp[ma + pn] = i;
			}
		}

		out.println(rn);
		for (int i = 0; i < rn; i++) {
			out.print(rp[i] + 1);
			out.print(i + 1 < rn ? " " : "\n");
		}
		out.close();
	}

	static public void main(String[] args) throws Exception {
		new subset_sk_n2logn_double_precise().run();
	}
}
