N,M = map(int,input().split()) MAXN = [] [MAXN.append([])for _ in range(M)] MAXV = [0]*M ans = 0 for i in range(N): L = (list(map(int,input().split()))) same = False update = False for j in range(M): if MAXV[j]==L[j]: MAXN[j].append(i) same = True elif MAXV[j]