program main
implicit None
	integer(8)::n,x,p,i,q
	integer(8),allocatable::a(:)
	
	read*,n,x
	allocate(a(n))
	
	read*,a
	
	a = abs(a-x)
	p = a(1)
	
	if(n>1)then
	do i = 2,n
		call euc(p,a(i),q)
		p = q
	enddo
	endif
	
	print "(i0)",p
end program main

subroutine euc(a1,b1,c)
implicit None
integer(8)::a1,b1,c,a,b
	
	a =a1
	b =b1
	c =1
	
	do while (a /=0 .and. b /= 0)
		if (a > b)then
			c =b
			a =mod(a,b)
			else
			c =a
			b =mod(b,a)
		endif
	enddo
end subroutine euc