Byteburg Senate elections are coming. Usually "United Byteland", the ruling Byteland party, takes all the seats in the Senate to ensure stability and sustainable development. But this year there is one opposition candidate in one of the constituencies. Even one opposition member can disturb the stability in the Senate, so the head of the Party asks you to ensure that the opposition candidate will not be elected.

There are n candidates, numbered from 1 to n. Candidate n is the opposition candidate. There are m polling stations in the constituency, numbered from 1 to m. You know the number of votes cast for each candidate at each polling station. The only thing you can do to prevent the election of the opposition candidate is to cancel the election results at some polling stations. The opposition candidate will be elected if the sum of the votes cast in their favor at all non-canceled stations will be strictly greater than the analogous sum for every other candidate. 

Your task is to prevent the election of the opposition candidate by canceling the election results at the minimal possible number of polling stations. Notice that solution always exists, because if you cancel the elections at all polling stations, the number of votes for each candidate will be 0, and the opposition candidate will not be elected.

Input

The first line of the input contains two integers n and m (2≤ n≤ 100; 1≤ m ≤ 100) — the number of candidates and the number of polling stations. The next m lines contain the election results at each polling station with n numbers on each line. In the i-th line the j-th number is a_{i,j} — the number of votes cast for the candidate j at the station i (0≤ a_{i,j} ≤ 1 000).

Output

In the first line output integer k — the minimal number of the polling stations in which you need to cancel the election results. In the second line output k integers — the indices of canceled polling stations, in any order. If there are multiple ways to cancel results at k stations, output any one of them.

Examples

Input


5 3
6 3 4 2 8
3 7 5 6 7
5 2 4 7 9


Output


2
3 1 


Input


2 1
1 1


Output


0



Input


3 3
2 3 8
4 2 9
3 1 7


Output


3
1 2 3 

Note

In the first example, the candidates from 1 to 5 received 14, 12, 13, 15, and 24 votes correspondingly. The opposition candidate has the most votes. However, if you cancel the election results at the first and the third polling stations, then only the result from the second polling station remains and the vote sums become 3, 7, 5, 6, and 7, without the opposition candidate being in the lead anymore.

Difficulty: MEDIUM_HARD
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
import math
IP = lambda : list(map(int, input().split()))
INF = 1000000000.0
(n, m) = IP()
lst = [[] for i in range(n)]
for i in range(m):
	d = IP()
	for j in range(n):
		lst[j].append(d[j])
s = [sum(i) for i in lst]
ret = [[] for i in range(n - 1)]
if s[-1] <= max(s[:-1]):
	print(0)
	print()
else:
	for i in range(n - 1):
		diff = s[-1] - s[i]
		for k in range(m):
			mdiff = idx = 0
			for j in range(m):
				if mdiff < lst[-1][j] - lst[i][j]:
					mdiff = lst[-1][j] - lst[i][j]
					idx = j
			ret[i].append(idx + 1)
			diff -= mdiff
			lst[i][idx] = 10 ** 9
			if diff <= 0:
				break
	idx = min([(len(ret[i]), i) for i in range(len(ret))])[1]
	print(len(ret[idx]))
	print(*ret[idx])


a = [int(s) for s in input().split()]
b = []
for numbers in range(a[1]):
	b.append([int(s) for s in input().split()])
c = [0 for i in range(len(b[0]))]
for i in range(len(b)):
	for j in range(len(b[0])):
		c[j] += b[i][j]
if c.index(max(c)) != len(c) - 1:
	print(0)
else:
	e = []
	for columns in range(len(b[0]) - 1):
		d = []
		for rows in range(len(b)):
			d.append([b[rows][-1] - b[rows][columns], b[rows][columns], b[rows][-1], rows + 1])
			d.sort(reverse=True)
			(e0, e1, num, l) = (c[columns], c[-1], 0, [])
			for delta in d:
				e0 -= delta[1]
				e1 -= delta[2]
				num += 1
				l.append(delta[-1])
				if e0 >= e1:
					e.append([num, l])
					break
	e.sort()
	print(e[0][0])
	for i in e[0][1]:
		print(i, end=' ')
	print()


import copy
a = list(map(int, input().split()))
can = a[0]
pol = a[1]
master = []
sortbycan = []
longest = []
for i in range(can):
	sortbycan.append([])
for i in range(pol):
	f = list(map(int, input().split()))
	for j in range(len(f)):
		f[j] = f[j] - f[-1]
	master.append(f)
for i in range(can):
	for j in range(pol):
		sortbycan[i].append(master[j][i])
sortedsort = copy.deepcopy(sortbycan)
for i in range(can):
	sortedsort[i].sort(reverse=True)
for i in range(can - 1):
	sum = 0
	j = 0
	while True:
		sum += sortedsort[i][j]
		if sum < 0:
			j -= 1
			break
		if j == pol - 1:
			break
		j += 1
	longest.append(pol - j - 1)
minimum = min(longest)
ind = longest.index(minimum)
indices = []
for i in range(minimum):
	k = sortedsort[ind][-1 - i]
	p = sortbycan[ind].index(k)
	indices.append(p + 1)
	sortbycan[ind][p] = 'x'
print(minimum)
thestring = ''
for i in range(len(indices)):
	thestring += str(indices[i]) + ' '
print(thestring)


def check(k):
	if max(s[0:-1]) < s[-1]:
		return True
	return False

def solve(ind, s):
	for i in range(m):
		v[i].append(v[i][ind] - v[i][-2])
	v.sort(key=lambda x: x[-1])
	count = 0
	for i in range(m):
		count += v[i][ind]
	x = []
	k = 0
	while count < s:
		s -= v[k][-3]
		count -= v[k][ind]
		x.append(v[k][-2] + 1)
		k += 1
	for i in range(m):
		v[i].pop()
	return x
(n, m) = map(int, input().split())
v = []
s = 0
for i in range(m):
	v.append(list(map(int, input().split())))
	v[-1].append(i)
	s += v[-1][-2]
res = m
ans = [i for i in range(1, m + 1)]
for i in range(n - 1):
	x = solve(i, s)
	if len(x) < res:
		res = len(x)
		ans = x[:]
print(res)
print(*ans)


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, m) = map(int, input().split())
	a = [list(map(int, input().split())) for _ in range(m)]
	c = list(map(lambda x: x[-1], a))
	z = sum(c)
	mi = [0] * (n + 1)
	for i in range(n - 1):
		b = []
		for j in range(m):
			b.append(a[j][i])
		d = sorted(range(m), key=lambda x: c[x] - b[x], reverse=True)
		(x, y) = (sum(b), z)
		if x >= y:
			mi = []
			continue
		e = []
		for j in range(m):
			x -= b[d[j]]
			y -= c[d[j]]
			e.append(d[j] + 1)
			if x >= y:
				if len(mi) > len(e):
					mi = e
				break
	print(len(mi))
	print(*mi)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def printMatrix(matrix):
	s = [[str(e) for e in row] for row in matrix]
	lens = [max(map(len, col)) for col in zip(*s)]
	fmt = '\t'.join(('{{:{}}}'.format(x) for x in lens))
	table = [fmt.format(*row) for row in s]
	print('_________________')
	print('\n'.join(table))
	print('`````````````````')
(n, m) = map(int, input().split())
Matrix = []
for i in range(m):
	temp = [int(x) for x in input().split()]
	Matrix.append(temp)
Diff = [[[0, 0] for i in range(n)] for j in range(m)]
for i in range(m):
	for j in range(n):
		Diff[i][j][0] = Matrix[i][n - 1] - Matrix[i][j]
		Diff[i][j][1] = i
Index = list(range(1, m + 1))
Remove = m
LastCol = [x[-1] for x in Matrix]
LAST = sum(LastCol)
for i in range(n - 1):
	Col = [x[i] for x in Diff]
	Real = [x[i] for x in Matrix]
	SUM = sum(Real)
	Col.sort(reverse=True)
	ind = 0
	while ind < m and SUM < LAST:
		SUM += Col[ind][0]
		ind += 1
	if ind < Remove:
		Index = []
		Remove = ind
		for x in range(ind):
			Index.append(Col[x][1] + 1)
if Index:
	print(Remove)
	print(*Index)
else:
	print(0)


def delta_ij(i, j):
	return lambda coll: coll[i] - coll[j]
(n, m) = map(int, input().split())
poll = [None] * m
for i in range(m):
	poll[i] = list(map(int, input().split()))
	poll[i].append(i + 1)
max_stat = 0
max_ally = 0
for try_best in range(n - 1):
	poll.sort(key=delta_ij(try_best, n - 1), reverse=True)
	i = 0
	balance = poll[0][try_best] - poll[0][n - 1]
	while balance >= 0:
		i += 1
		if i < m:
			balance += poll[i][try_best] - poll[i][n - 1]
		else:
			break
	if i > max_stat:
		max_stat = i
		max_ally = try_best
poll.sort(key=delta_ij(max_ally, n - 1))
stations_cancel = list(map(lambda coll: coll[-1], poll))[:m - max_stat]
print(m - max_stat)
print(' '.join(map(str, stations_cancel)))


(m, n) = map(int, input().split())
l = []
ll = []
for i in range(n):
	l = list(map(int, input().split()))
	l = [l[j] - l[-1] for j in range(m)]
	ll.append(l)
w = [[[ll[j][i], j + 1] for j in range(n)] for i in range(m - 1)]
for i in w:
	i.sort(reverse=True)
md = -1
ind = 0
maxind = 0
for i in w:
	ind += 1
	x = 0
	summ = 0
	for j in i:
		summ += j[0]
		if summ >= 0:
			x += 1
		else:
			break
	if x > md:
		md = x
		maxind = ind
ans = []
print(n - md)
for i in range(md, n):
	ans.append(w[maxind - 1][i][1])
print(*ans)


(n, m) = map(int, input().split())
sum_votes = [0] * n
diffs = [[] for _ in range(n - 1)]
for i in range(m):
	votes = list(map(int, input().split()))
	for j in range(n - 1):
		sum_votes[j] += votes[j]
		diffs[j].append(votes[n - 1] - votes[j])
	sum_votes[n - 1] += votes[n - 1]
sum_diffs = []
for i in range(n - 1):
	sum_diffs.append(sum_votes[n - 1] - sum_votes[i])
k = m
for i in range(n - 1):
	count_diff = 0
	cur_diffs_idxs = sorted(range(m), key=lambda k: diffs[i][k], reverse=True)
	j = 0
	while j < m and count_diff < sum_diffs[i]:
		count_diff += diffs[i][cur_diffs_idxs[j]]
		j += 1
	if j < k:
		k = j
		temp_ans = cur_diffs_idxs[:j]
print(k)
if k == m:
	print(*[i + 1 for i in range(m)])
else:
	print(*[i + 1 for i in temp_ans])


a = []
b = []
total = []
opp = 0
ans = []
max_vote = 0
(n, m) = [int(x) for x in input().split()]
for i in range(n):
	total.append(0)
for i in range(m):
	ans.append(i + 1)
	b = [int(x) for x in input().split()]
	b.append(i + 1)
	for j in range(n - 1):
		total[j] += b[j]
	opp += b[n - 1]
	a.append(b)
for k in range(n):
	ans_temp = []
	opp_temp = opp
	max_vote = total[k]
	a.sort(key=lambda x: x[n - 1] - x[k])
	for i in range(m - 1, -1, -1):
		if opp_temp > max_vote:
			b = a[i]
			ans_temp.append(b[n])
			opp_temp -= b[n - 1]
			max_vote -= b[k]
		else:
			break
	if len(ans_temp) < len(ans):
		ans = []
		ans = ans_temp
print(len(ans))
for i in ans:
	print(i, end=' ')
print()


def solve(n, m, a):
	answer = [i + 1 for i in range(m)]
	for i in range(n - 1):
		pret = solve_two(m, a[i], a[n - 1])
		if len(answer) > len(pret):
			answer = pret
	return answer

def solve_two(m, a1, a0):
	dif = []
	difsum = 0
	for i in range(m):
		dif.append((a1[i] - a0[i], i + 1))
		difsum += a1[i] - a0[i]
	dif.sort(key=lambda d: d[0])
	answer = []
	for i in range(m):
		if difsum >= 0:
			break
		difsum -= dif[i][0]
		answer.append(dif[i][1])
	return answer

def main():
	(n, m) = [int(s) for s in input().split()]
	a = [[0] * m for _ in range(n)]
	for i in range(m):
		line = [int(s) for s in input().split()]
		for j in range(n):
			a[j][i] = line[j]
	answer = solve(n, m, a)
	print(len(answer))
	for c in answer:
		print(c, end=' ')
main()


import sys

def input():
	return sys.stdin.readline().rstrip()

def slv():
	(n, m) = map(int, input().split())
	POLLS = [list(map(int, input().split())) for i in range(m)]
	ans = m
	ansque = [i + 1 for i in range(m)]
	for idx in range(n - 1):
		stack = []
		for i in range(m):
			stack.append((POLLS[i][idx] - POLLS[i][-1], i))
		stack.sort()
		d = sum((v[0] for v in stack))
		i = 0
		que = []
		while i < m and d < 0:
			d -= stack[i][0]
			que.append(stack[i][1] + 1)
			i += 1
		if ans > i:
			ans = i
			ansque = que
	print(ans)
	print(*ansque)
	return

def main():
	t = 1
	for i in range(t):
		slv()
	return
main()


(n, m) = map(int, input().split())
a = []
for i in range(m):
	b = list(map(int, input().split()))
	a.append(b)
coll = []
total = []
count = 0
diff = [[] for i in range(n)]
for i in range(n):
	count = 0
	for j in range(m):
		count += a[j][i]
		diff[i].append([a[j][n - 1] - a[j][i], j + 1])
	total.append(count)
for i in range(n):
	diff[i].sort(reverse=True)
mini = 99999999
store = []
d = 0
for i in range(n - 1):
	d = total[n - 1] - total[i]
	plus = 0
	count = 0
	while plus < d:
		plus += diff[i][count][0]
		count += 1
	if count < mini:
		mini = count
		store = diff[i]
if len(store) == 0:
	print(0)
else:
	print(mini)
	for i in range(mini):
		print(store[i][1], end=' ')


import copy
from operator import itemgetter
(n, m) = map(int, input().split())
a = []
for i in range(m):
	a.append([i] + [int(x) for x in input().split()])
b = [0 for x in range(n)]
for i in range(m):
	for j in range(1, n + 1):
		b[j - 1] += a[i][j]
aans = [x for x in range(n * m)]
aa = copy.deepcopy(a)
bb = copy.deepcopy(b)
for some in range(1, n):
	a = copy.deepcopy(aa)
	b = copy.deepcopy(bb)
	for i in range(m):
		a[i].append(a[i][-1] - a[i][some])
	ans = []
	a.sort(key=itemgetter(-1), reverse=True)
	for i in range(m):
		if b[-1] <= max(b[:-1]):
			break
		if True:
			ans.append(a[i][0] + 1)
			for j in range(1, n + 1):
				b[j - 1] -= a[i][j]
	if len(ans) < len(aans):
		aans = ans
print(len(aans))
print(*aans)


(n, m) = map(int, input().split())
s = [[0] * (n + 2)]
num = s + [[0] + [int(x) for x in input().split()] + [0] for i in range(m)] + s
ans = 0
ansss = []
for i in range(1, n):
	d = []
	anss = []
	for j in range(1, m + 1):
		d.append([num[j][n] - num[j][i], j])
	d.sort()
	tmp = 0
	cnt = 0
	for i in range(len(d)):
		if tmp + d[i][0] <= 0:
			tmp += d[i][0]
			cnt += 1
			anss.append(d[i][1])
		else:
			break
	if cnt > ans:
		ans = cnt
		ansss = anss
print(m - ans)
for i in range(1, m + 1):
	if i not in ansss:
		print(i, end=' ')
print('')


(col, ro) = map(int, input().split())
grid = []
for i in range(ro):
	l = list(map(int, input().split()))
	l = [l[k] - l[-1] for k in range(len(l))]
	grid += [l]
work = [[[grid[j][i], j + 1] for j in range(ro)] for i in range(col - 1)]
for i in work:
	i.sort(reverse=True)
maxi = 0
maxind = 0
ind = 0
for i in work:
	ind += 1
	summ = 0
	x = 0
	for k in i:
		summ += k[0]
		if summ >= 0:
			x += 1
		else:
			break
	if x >= maxi:
		maxi = x
		maxind = ind
print(ro - maxi)
ans = []
for i in range(maxi, ro):
	ans += [work[maxind - 1][i][1]]
ans.sort()
print(*ans)


def getMaxBoothForCandidateToWin(candidate, opposition, m):
	diff = []
	for i in range(m):
		diff.append([candidate[i] - opposition[i], i])
	diff.sort(key=lambda x: x[0], reverse=True)
	prefixSum = 0
	maxBooth = 0
	pollingStations = []
	for (x, station) in diff:
		if prefixSum + x < 0:
			break
		prefixSum += x
		pollingStations.append(station)
		maxBooth += 1
	return (maxBooth, pollingStations)

def main():
	(n, m) = readIntArr()
	arr = []
	for _ in range(m):
		arr.append(readIntArr())
	opposition = []
	for i in range(m):
		opposition.append(arr[i][n - 1])
	maxBooth = 0
	pollingStations = []
	for i in range(n - 1):
		candidate = []
		for j in range(m):
			candidate.append(arr[j][i])
		(mb, ps) = getMaxBoothForCandidateToWin(candidate, opposition, m)
		if mb > maxBooth:
			maxBooth = mb
			pollingStations = ps
	minBooths = m - maxBooth
	psSet = set(pollingStations)
	removedStations = []
	for i in range(m):
		if i not in psSet:
			removedStations.append(i)
	for i in range(len(removedStations)):
		removedStations[i] += 1
	print(minBooths)
	oneLineArrayPrint(removedStations)
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultVal, dimensionArr):
	dv = defaultVal
	da = dimensionArr
	if len(da) == 1:
		return [dv for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(x, y):
	print('? {} {}'.format(x, y))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


import sys

def get_largest(arr):
	s = 0
	n = len(arr)
	l = []
	for i in range(n):
		if arr[i] >= 0:
			s += arr[i]
		else:
			l.append([arr[i], i])
	l.sort()
	i = len(l) - 1
	while i >= 0 and s >= 0:
		s += l[i][0]
		i -= 1
	if s >= 0:
		return (0, [])
	else:
		ans = []
		i += 1
		for j in range(i + 1):
			ans.append(l[j][1])
		return (len(ans), ans)
(n, m) = map(int, sys.stdin.readline().split())
arr = []
for _ in range(m):
	l = list(map(int, sys.stdin.readline().split()))
	arr.append(l)
for i in range(m):
	for j in range(n - 1):
		arr[i][j] = arr[i][j] - arr[i][-1]
rel = []
for i in range(n):
	l = []
	for j in range(m):
		l.append(arr[j][i])
	rel.append(l)
(a, ans) = (float('inf'), [])
for i in range(len(rel) - 1):
	(c, d) = get_largest(rel[i])
	if c < a:
		ans = [x + 1 for x in d]
		a = c
print(a)
print(*ans)


(n, m) = map(int, input().split())
votes = []
for _ in range(m):
	votes.append(list(map(int, input().split())))
diff = []
for i in range(n - 1):
	li = []
	for ii in range(m):
		li.append((votes[ii][n - 1] - votes[ii][i], ii))
	li.sort(reverse=True)
	diff.append(li)
maindiff = []
val = 0
for i in range(m):
	val += votes[i][n - 1]
for i in range(n - 1):
	summ = 0
	for ii in range(m):
		summ += votes[ii][i]
	maindiff.append(val - summ)
aa = []
for i in range(n - 1):
	q = maindiff[i]
	j = 0
	count = 0
	zi = []
	while q > 0 and j < m:
		q -= diff[i][j][0]
		zi.append(diff[i][j][1] + 1)
		j += 1
		count += 1
	aa.append((count, zi))
r = min(aa)
print(r[0])
print(*r[1])


from collections import defaultdict
d = defaultdict(list)
(n, m) = map(int, input().split())
for i in range(m):
	l = list(map(int, input().split()))
	for j in range(len(l) - 1):
		d[j].append((l[-1] - l[j], i))
ind = [i + 1 for i in range(m)]
minl = m
for j in range(n - 1):
	temp = []
	d[j].sort(reverse=True)
	s = 0
	for p in range(len(d[j])):
		s += d[j][p][0]
	k = -1
	while s > 0:
		k += 1
		s -= d[j][k][0]
		temp.append(d[j][k][1] + 1)
	if len(temp) < minl:
		ind = temp
		minl = len(temp)
print(len(ind))
print(*ind)


(n, m) = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]

def calc(idx):
	diff = sorted([(x[-1] - x[idx], i) for (i, x) in enumerate(a)])
	tot = sum([x[0] for x in diff])
	ans = []
	while tot > 0:
		tot -= diff[-1][0]
		ans.append(diff[-1][1] + 1)
		diff.pop()
	return ans
ans = [i + 1 for i in range(m)]
for i in range(n - 1):
	temp = calc(i)
	if len(temp) < len(ans):
		ans = temp
print(len(ans))
print(' '.join(map(str, ans)))


def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z
(n, k) = map(int, input().split())
v = []
diff = [[0 for i in range(k)] for j in range(n)]
ind = [[0 for i in range(k)] for j in range(n)]
an = [[] for i in range(n)]
r = [0] * (n - 1)
su = [0] * n
for i in range(k):
	v.append(list(map(int, input().split())))
for i in range(n):
	for j in range(k):
		su[i] += v[j][i]
		diff[i][j] = v[j][i] - v[j][n - 1]
		ind[i][j] = j + 1
for i in range(n - 1):
	ind[i] = sort_list(ind[i], diff[i])
	diff[i].sort()
	if su[i] - su[n - 1] >= 0:
		r[i] = 0
	else:
		t = 0
		dif = su[n - 1] - su[i]
		while dif > 0:
			dif += diff[i][t]
			t += 1
			an[i].append(ind[i][t - 1])
		r[i] = t
print(min(r))
print(*an[r.index(min(r))], sep=' ')


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def main():
	mod = 998244353
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		(n, m) = ria()
		z = []
		for i in range(m):
			z.append([ria(), i + 1])
		ans = [0] * 105
		for i in range(n - 1):
			votesi = 0
			votesn = 0
			for j in range(m):
				votesi += z[j][0][i]
				votesn += z[j][0][n - 1]
			tz = z.copy()
			tans = []
			while votesi < votesn:
				maxdiff = 0
				for j in range(len(tz)):
					diff = tz[j][0][n - 1] - tz[j][0][i]
					if diff > maxdiff:
						maxdiff = diff
						inddel = j
				tans.append(tz[inddel][1])
				del tz[inddel]
				votesi = 0
				votesn = 0
				for j in range(len(tz)):
					votesi += tz[j][0][i]
					votesn += tz[j][0][n - 1]
			if len(tans) < len(ans):
				ans = tans
		wi(len(ans))
		wia(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import heapq
from collections import defaultdict
(n, m) = map(int, input().split())
poll = []
total = [0 for s in range(n)]
for s in range(m):
	v0 = list(map(int, input().split()))
	poll.append(v0)
	for b in range(n):
		total[b] += v0[b]
minny = n + 1
a1 = []
for s in range(n - 1):
	if total[s] >= total[n - 1]:
		minny = 0
		break
	else:
		maxh = []
		heapq.heapify(maxh)
		inds = defaultdict(list)
		for b in range(m):
			diff = poll[b][s] - poll[b][n - 1]
			heapq.heappush(maxh, diff)
			inds[diff].append(b + 1)
		s1 = total[s]
		ans = 0
		a2 = []
		while len(maxh) > 0 and s1 < total[n - 1]:
			v1 = -heapq.heappop(maxh)
			s1 += v1
			ans += 1
			a2.append(inds[-v1].pop())
		if ans < minny:
			minny = ans
			a1 = a2.copy()
print(minny)
print(*a1)


from math import inf

def func(i):
	return arr[i][n - 1] - arr[i][j]
(n, m) = map(int, input().split())
arr = [[0 for i in range(n)] for j in range(m)]
for i in range(m):
	inp = list(map(int, input().split()))
	for j in range(n):
		arr[i][j] = inp[j]
sumsarr = []
for j in range(n):
	sums = 0
	for i in range(m):
		sums += arr[i][j]
	sumsarr += [sums]
if max(sumsarr) != sumsarr[-1]:
	print(0)
else:
	bestop = inf
	for j in range(n - 1):
		temp = sumsarr[-1]
		op = 0
		index = [i for i in range(m)]
		index.sort(key=func)
		while temp > sumsarr[j]:
			if func(index[-1]) >= 0:
				temp -= arr[index[-1]][n - 1]
				sumsarr[j] -= arr[index[-1]][j]
				index.pop()
				op += 1
			else:
				break
		if bestop > op:
			ansj = j
			bestop = op
	print(str(bestop))
	index = [i for i in range(m)]
	j = ansj
	index.sort(key=func)
	while bestop:
		print(index[-1] + 1, end=' ')
		index.pop()
		bestop -= 1


(n, m) = [int(x) for x in input().split()]
mat = []
for i in range(m):
	a = [int(x) for x in input().split()]
	a = [a[-1] - x for x in a]
	a[len(a) - 1] = i + 1
	mat.append(a)
minimum = [m, [x for x in range(1, m + 1)]]
prt = False
for i in range(n - 1):
	cnt = 0
	mat.sort(key=lambda x: x[i])
	sums = 0
	for j in range(m):
		sums += mat[j][i]
		if sums <= 0:
			cnt += 1
		elif minimum[0] > m - cnt:
			minimum[0] = m - cnt
			cand = []
			for k in range(j, m):
				cand.append(mat[k][-1])
			minimum[1] = cand
			break
	if cnt == m:
		prt = True
		break
if prt:
	print(0)
else:
	print(minimum[0])
	print(*minimum[1])


(n, m) = map(int, input().split())
ll = [[] for i in range(n - 1)]
for i in range(m):
	a = list(map(int, input().split()))
	for j in range(n - 1):
		ll[j].append([a[-1] - a[j], i])
mi = 10000000
for l in ll:
	l.sort()
	s = sum([l[j][0] for j in range(m)])
	temp = []
	j = 1
	while s > 0:
		temp.append(l[-j][1])
		s -= l[-j][0]
		j += 1
	if len(temp) < mi:
		mi = len(temp)
		ans = temp[:]
print(mi)
print(*[i + 1 for i in ans])


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(col, ro) = map(int, input().split())
grid = []
for i in range(ro):
	l = list(map(int, input().split()))
	l = [l[k] - l[-1] for k in range(len(l))]
	grid += [l]
work = [[[grid[j][i], j + 1] for j in range(ro)] for i in range(col - 1)]
for i in work:
	i.sort(reverse=True)
maxi = 0
maxind = 0
ind = 0
for i in work:
	ind += 1
	summ = 0
	x = 0
	for k in i:
		summ += k[0]
		if summ >= 0:
			x += 1
		else:
			break
	if x >= maxi:
		maxi = x
		maxind = ind
print(ro - maxi)
ans = []
for i in range(maxi, ro):
	ans += [work[maxind - 1][i][1]]
ans.sort()
print(*ans)


(n, m) = map(int, input().split())
stations = []
res = []
notGood = []
for i in range(m):
	stations.append(list(map(int, input().split())))
colsum = [sum([stations[j][i] for j in range(m)]) for i in range(n)]

def elect(m):
	ans = m
	stat = [i + 1 for i in range(m)]
	for ind in range(len(colsum) - 1):
		notGood = []
		for i in range(m):
			notGood.append((stations[i][-1] - stations[i][ind], i + 1))
		diff = colsum[-1] - colsum[ind]
		notGood.sort(key=lambda x: x[0], reverse=True)
		add = 0
		for i in range(len(notGood)):
			add += notGood[i][0]
			if add >= diff and ans > i + 1:
				ans = i + 1
				stat = [x[1] for x in notGood[:i + 1]]
				break
	print(ans)
	print(*stat)
if colsum[-1] > max(colsum[:-1]):
	elect(m)
else:
	print(0)


from sys import stdin, stdout
(n, m) = map(int, stdin.readline().split())
leads = {}
for i in range(1, m + 1):
	vs = list(map(int, stdin.readline().split()))
	base = vs[-1]
	for j in range(n - 1):
		leads.setdefault(j, []).append((vs[j] - base, i))
ans = None
for llist in leads.values():
	llist.sort(reverse=True)
	lsum = 0
	idx = m
	for (i, l) in enumerate(llist):
		lsum += l[0]
		if lsum < 0:
			idx = i
			break
	if not ans or m - idx < len(ans):
		ans = llist[idx:]
stdout.write('{}\n'.format(len(ans)))
stdout.write(' '.join((str(l[1]) for l in ans)))


from collections import defaultdict
(n, m) = map(int, input().split())
d = defaultdict(list)
sums = [0] * (n - 1)
minim = [1] * (m + 1)
for i in range(m):
	l = list(map(int, input().split()))
	for j in range(n - 1):
		sums[j] += l[j] - l[-1]
		if l[j] - l[-1] < 0:
			d[j].append((l[j] - l[-1], i + 1))
for i in d:
	d[i].sort()
for i in range(n - 1):
	s = sums[i]
	idx = []
	for x in d[i]:
		if s >= 0:
			break
		s -= x[0]
		idx.append(x[-1])
	if len(idx) < len(minim):
		minim = idx
print(len(minim))
print(*minim)


import sys
import collections
from collections import Counter
import itertools
import math
import timeit

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
(n, m) = mi()
p = [[] for i in range(n)]
for i in range(m):
	d = li()
	for j in range(n):
		p[j].append(d[j])
sums = [sum(i) for i in p]
if max(sums[:-1]) >= sums[-1]:
	exit(print(0))
res = [[] for i in range(n)]
for i in range(n - 1):
	dif = sums[-1] - sums[i]
	for j in range(m):
		maxd = pos = 0
		for k in range(m):
			if maxd < p[-1][k] - p[i][k]:
				maxd = p[-1][k] - p[i][k]
				pos = k
		res[i].append(pos + 1)
		p[i][pos] = 1000
		dif -= maxd
		if dif <= 0:
			break
pos = 0
for i in range(n - 1):
	if len(res[i]) < len(res[pos]):
		pos = i
print(len(res[pos]))
prr(res[pos])


(n, m) = map(int, input().split())
stations = []
for __ in range(m):
	stations.append(list(map(int, input().split())))
cancelleds = []
min_cancelled = m
for i in range(n - 1):
	votes = [stations[j][i] for j in range(m)]
	challenger = [stations[j][n - 1] for j in range(m)]
	differences = [(i + 1, challenger[i] - votes[i]) for i in range(m)]
	differences = list(sorted(differences, key=lambda elem: elem[1]))
	current_diff = sum([differences[i][1] for i in range(m)])
	cancelled = []
	while current_diff > 0:
		(idx, value) = differences.pop()
		current_diff -= value
		cancelled.append(idx)
	cancelleds.append(cancelled)
	min_cancelled = min(min_cancelled, len(cancelled))
for cancelled in cancelleds:
	if len(cancelled) == min_cancelled:
		print(min_cancelled)
		print(' '.join(map(str, cancelled)))
		exit()


(n, m) = [int(i) for i in input().split()]
d = [[] for i in range(n - 1)]
for k in range(m):
	a = [int(i) for i in input().split()]
	for i in range(n - 1):
		d[i].append([a[-1] - a[i], k])
c = 1000
for i in d:
	i.sort()
	s = sum([t[0] for t in i])
	t = []
	while s > 0:
		t.append(i[-1][1])
		s -= i.pop()[0]
	if m - len(i) < c:
		c = m - len(i)
		f = t
if c:
	print(c, ' '.join([str(i + 1) for i in f]), sep='\n')
else:
	print(0)