program main
implicit none
integer :: i, g
integer :: n, m
integer , allocatable :: x(:)

read(*,*) n, m
allocate( x(n) )
read(*,*) x(1:n)
x = abs(x -m)
if( n == 1 ) then
   write(*,'(i0)') x(1)
else
   do i = 1, n-1
      call gcdlcm(x(i), x(i+1), g)
      x(i+1) = g
   end do
   write(*,'(i0)') g
end if

stop
contains
  subroutine gcdlcm( a, b, g )
    integer , intent(in)  :: a, b
    integer , intent(out) :: g

    integer :: i, j, k,l

    i = a
    j = b
    do while( j /= 0 )
       k = mod(i,j)
       i = j
       j = k
    end do
    g = i
    l = a*b/g
  end subroutine gcdlcm

end program main

