program test
implicit none
integer :: i,n,m,x,a(100),aa(100)=0, cost

read(*,*)  n,m,x
read(*,*)  (a(i),i=1,m)

do i = 1, m
 aa(a(i)) = 1
enddo

cost = min(sum(aa(:x-1)),sum(aa(x+1:)))

write(*,*) cost

end program