import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		int a;
		boolean existRyokin[] = new boolean[n];
		for (int i=0; i<m; i++){
			a = sc.nextInt();
			existRyokin[a] = true;
		}
		int leftCost = 0;
		int rightCost = 0;
		for (int i=x; i>0; i--){
			if (existRyokin[i]){
				leftCost ++;
			}
		}
		for (int i=x; i<n; i++){
			if (existRyokin[i]){
				rightCost ++;
			}
		}
		System.out.println(Math.min(leftCost, rightCost));
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		int a;
		boolean existRyokin[] = new boolean[n];
		for (int i=0; i<m; i++){
			a = sc.nextInt();
			existRyokin[a] = true;
		}
		int leftCost = 0;
		int rightCost = 0;
		for (int i=x; i>0; i--){
			if (existRyokin[i]){
				leftCost ++;
			}
		}
		for (int i=x; i<n; i++){
			if (existRyokin[i]){
				rightCost ++;
			}
		}
		System.out.println(Math.min(leftCost, rightCost));
	}
} Main public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		int a;
		boolean existRyokin[] = new boolean[n];
		for (int i=0; i<m; i++){
			a = sc.nextInt();
			existRyokin[a] = true;
		}
		int leftCost = 0;
		int rightCost = 0;
		for (int i=x; i>0; i--){
			if (existRyokin[i]){
				leftCost ++;
			}
		}
		for (int i=x; i<n; i++){
			if (existRyokin[i]){
				rightCost ++;
			}
		}
		System.out.println(Math.min(leftCost, rightCost));
	} main {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		int a;
		boolean existRyokin[] = new boolean[n];
		for (int i=0; i<m; i++){
			a = sc.nextInt();
			existRyokin[a] = true;
		}
		int leftCost = 0;
		int rightCost = 0;
		for (int i=x; i>0; i--){
			if (existRyokin[i]){
				leftCost ++;
			}
		}
		for (int i=x; i<n; i++){
			if (existRyokin[i]){
				rightCost ++;
			}
		}
		System.out.println(Math.min(leftCost, rightCost));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int a; a boolean existRyokin[] = new boolean[n]; existRyokin new boolean[n] n for (int i=0; i<m; i++){
			a = sc.nextInt();
			existRyokin[a] = true;
		} int i=0; int i=0; i 0 i<m i m i++ i++ i {
			a = sc.nextInt();
			existRyokin[a] = true;
		} {
			a = sc.nextInt();
			existRyokin[a] = true;
		} a = sc.nextInt() a sc.nextInt() sc.nextInt sc existRyokin[a] = true existRyokin[a] existRyokin a true int leftCost = 0; leftCost 0 int rightCost = 0; rightCost 0 for (int i=x; i>0; i--){
			if (existRyokin[i]){
				leftCost ++;
			}
		} int i=x; int i=x; i x i>0 i 0 i-- i-- i {
			if (existRyokin[i]){
				leftCost ++;
			}
		} {
			if (existRyokin[i]){
				leftCost ++;
			}
		} if (existRyokin[i]){
				leftCost ++;
			} existRyokin[i] existRyokin i {
				leftCost ++;
			} leftCost ++ leftCost for (int i=x; i<n; i++){
			if (existRyokin[i]){
				rightCost ++;
			}
		} int i=x; int i=x; i x i<n i n i++ i++ i {
			if (existRyokin[i]){
				rightCost ++;
			}
		} {
			if (existRyokin[i]){
				rightCost ++;
			}
		} if (existRyokin[i]){
				rightCost ++;
			} existRyokin[i] existRyokin i {
				rightCost ++;
			} rightCost ++ rightCost System.out.println(Math.min(leftCost, rightCost)) System.out.println System.out System System.out Math.min(leftCost, rightCost) Math.min Math leftCost rightCost String[] args args public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		int a;
		boolean existRyokin[] = new boolean[n];
		for (int i=0; i<m; i++){
			a = sc.nextInt();
			existRyokin[a] = true;
		}
		int leftCost = 0;
		int rightCost = 0;
		for (int i=x; i>0; i--){
			if (existRyokin[i]){
				leftCost ++;
			}
		}
		for (int i=x; i<n; i++){
			if (existRyokin[i]){
				rightCost ++;
			}
		}
		System.out.println(Math.min(leftCost, rightCost));
	}
} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		int a;
		boolean existRyokin[] = new boolean[n];
		for (int i=0; i<m; i++){
			a = sc.nextInt();
			existRyokin[a] = true;
		}
		int leftCost = 0;
		int rightCost = 0;
		for (int i=x; i>0; i--){
			if (existRyokin[i]){
				leftCost ++;
			}
		}
		for (int i=x; i<n; i++){
			if (existRyokin[i]){
				rightCost ++;
			}
		}
		System.out.println(Math.min(leftCost, rightCost));
	}
} Main
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();

		int a;
		boolean existRyokin[] = new boolean[n];
		for (int i=0; i<m; i++){
			a = sc.nextInt();
			existRyokin[a] = true;
		}
		int leftCost = 0;
		int rightCost = 0;
		for (int i=x; i>0; i--){
			if (existRyokin[i]){
				leftCost ++;
			}
		}
		for (int i=x; i<n; i++){
			if (existRyokin[i]){
				rightCost ++;
			}
		}
		System.out.println(Math.min(leftCost, rightCost));
	}
}
