program sample
    implicit none
    character(100)::s
    integer(8) :: i,j,m,n,a,b,c,k
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,k
    allocate(x(n))
    read(*,*)x
    m=10**9
    do i=1,n
        a=abs(x(i)-k)
        do 
            if(mod(a,m)==0)then
                exit
            end if
            m=mod(a,m)
        end do
    end do
    write(*,*)m
    stop
end program sample
  

