N=io.read("n")
X=io.read("n")
x={}
for i=1,N do
  x[i]=io.read("n")
end
function d(a,b)
  while(true) do
  	local r=a%b
  	a=b
  	b=r
 	if r==0 then
    break
    end
  end
return a
end
    	
res=math.abs(X-x[1])
for i=2,N do
  res=d(res,math.abs(X-x[i]))
end
print(res)