 import java.util.ArrayList;
import java.util.Scanner;
 class Main  {
     public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
         int n = scan.nextInt();
         int m = scan.nextInt();
         int x = scan.nextInt();
         ArrayList<Integer> a = new ArrayList<>();
         for(int i = 0 ; i<m;i++){
             a.add(scan.nextInt());
         }
         int max ;
  
         int cost = 0 ;
         for(int i = 1 ; i< x ; i++){
             if(a.contains(i)){
                 cost++;
             }
         }
         
         int cost2 = 0 ;
         for(int i = x+1 ; i< n+1 ; i++){
             if(a.contains(i)){
                 cost2++;
             }
         }
         System.out.println(Math.min(cost,cost2));
     }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util class Main  {
     public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
         int n = scan.nextInt();
         int m = scan.nextInt();
         int x = scan.nextInt();
         ArrayList<Integer> a = new ArrayList<>();
         for(int i = 0 ; i<m;i++){
             a.add(scan.nextInt());
         }
         int max ;
  
         int cost = 0 ;
         for(int i = 1 ; i< x ; i++){
             if(a.contains(i)){
                 cost++;
             }
         }
         
         int cost2 = 0 ;
         for(int i = x+1 ; i< n+1 ; i++){
             if(a.contains(i)){
                 cost2++;
             }
         }
         System.out.println(Math.min(cost,cost2));
     }
} Main public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
         int n = scan.nextInt();
         int m = scan.nextInt();
         int x = scan.nextInt();
         ArrayList<Integer> a = new ArrayList<>();
         for(int i = 0 ; i<m;i++){
             a.add(scan.nextInt());
         }
         int max ;
  
         int cost = 0 ;
         for(int i = 1 ; i< x ; i++){
             if(a.contains(i)){
                 cost++;
             }
         }
         
         int cost2 = 0 ;
         for(int i = x+1 ; i< n+1 ; i++){
             if(a.contains(i)){
                 cost2++;
             }
         }
         System.out.println(Math.min(cost,cost2));
     } main {
         Scanner scan = new Scanner(System.in);
         int n = scan.nextInt();
         int m = scan.nextInt();
         int x = scan.nextInt();
         ArrayList<Integer> a = new ArrayList<>();
         for(int i = 0 ; i<m;i++){
             a.add(scan.nextInt());
         }
         int max ;
  
         int cost = 0 ;
         for(int i = 1 ; i< x ; i++){
             if(a.contains(i)){
                 cost++;
             }
         }
         
         int cost2 = 0 ;
         for(int i = x+1 ; i< n+1 ; i++){
             if(a.contains(i)){
                 cost2++;
             }
         }
         System.out.println(Math.min(cost,cost2));
     } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan ArrayList<Integer> a = new ArrayList<>(); a new ArrayList<>() for(int i = 0 ; i<m;i++){
             a.add(scan.nextInt());
         } int i = 0 ; int i = 0 ; i 0 i<m i m i++ i++ i {
             a.add(scan.nextInt());
         } {
             a.add(scan.nextInt());
         } a.add(scan.nextInt()) a.add a scan.nextInt() scan.nextInt scan int max ; max int cost = 0 ; cost 0 for(int i = 1 ; i< x ; i++){
             if(a.contains(i)){
                 cost++;
             }
         } int i = 1 ; int i = 1 ; i 1 i< x i x i++ i++ i {
             if(a.contains(i)){
                 cost++;
             }
         } {
             if(a.contains(i)){
                 cost++;
             }
         } if(a.contains(i)){
                 cost++;
             } a.contains(i) a.contains a i {
                 cost++;
             } cost++ cost int cost2 = 0 ; cost2 0 for(int i = x+1 ; i< n+1 ; i++){
             if(a.contains(i)){
                 cost2++;
             }
         } int i = x+1 ; int i = x+1 ; i x+1 x 1 i< n+1 i n+1 n 1 i++ i++ i {
             if(a.contains(i)){
                 cost2++;
             }
         } {
             if(a.contains(i)){
                 cost2++;
             }
         } if(a.contains(i)){
                 cost2++;
             } a.contains(i) a.contains a i {
                 cost2++;
             } cost2++ cost2 System.out.println(Math.min(cost,cost2)) System.out.println System.out System System.out Math.min(cost,cost2) Math.min Math cost cost2 String[]args args
 import java.util.ArrayList;
import java.util.Scanner;
 class Main  {
     public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
         int n = scan.nextInt();
         int m = scan.nextInt();
         int x = scan.nextInt();
         ArrayList<Integer> a = new ArrayList<>();
         for(int i = 0 ; i<m;i++){
             a.add(scan.nextInt());
         }
         int max ;
  
         int cost = 0 ;
         for(int i = 1 ; i< x ; i++){
             if(a.contains(i)){
                 cost++;
             }
         }
         
         int cost2 = 0 ;
         for(int i = x+1 ; i< n+1 ; i++){
             if(a.contains(i)){
                 cost2++;
             }
         }
         System.out.println(Math.min(cost,cost2));
     }
}
