n,m=map(int,input().split()) s=[list(map(int,input().split()))for i in range(n)] for i in range(n):s[i].sort() from bisect import* def le(a, x): i = bisect_right(a, x) if i:return a[i-1] return -1 def ge(a, x): i = bisect_left(a, x) if i != len(a):return a[i] return -1 def validate(x): ans=10**18 for i in range(m): c=s[0][i] k=0 for j in range(1,n): r=le(s[j],c+x) if r==-1 or r