import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[m];
		for(int i = 0 ; i < m ; i++) a[i] = sc.nextInt();
		int first = 0;
		int last = 0;
		int now = x;
		while(now != 0) {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		}
		now = x;
		while(now != n) {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		}
		System.out.println(Math.min(first, last));
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[m];
		for(int i = 0 ; i < m ; i++) a[i] = sc.nextInt();
		int first = 0;
		int last = 0;
		int now = x;
		while(now != 0) {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		}
		now = x;
		while(now != n) {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		}
		System.out.println(Math.min(first, last));
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[m];
		for(int i = 0 ; i < m ; i++) a[i] = sc.nextInt();
		int first = 0;
		int last = 0;
		int now = x;
		while(now != 0) {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		}
		now = x;
		while(now != n) {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		}
		System.out.println(Math.min(first, last));
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[m];
		for(int i = 0 ; i < m ; i++) a[i] = sc.nextInt();
		int first = 0;
		int last = 0;
		int now = x;
		while(now != 0) {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		}
		now = x;
		while(now != n) {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		}
		System.out.println(Math.min(first, last));
	} 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 = new int[m]; a new int[m] m for(int i = 0 ; i < m ; i++) a[i] = sc.nextInt(); int i = 0 ; int i = 0 ; i 0 i < m i m i++ i++ i a[i] = sc.nextInt(); a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int first = 0; first 0 int last = 0; last 0 int now = x; now x while(now != 0) {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		} now != 0 now 0 {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		} now-- now for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			} int i = 0 ; int i = 0 ; i 0 i < m i m i++ i++ i {
				if(a[i] == now) first++;
			} {
				if(a[i] == now) first++;
			} if(a[i] == now) first++; a[i] == now a[i] a i now first++ first now = x now x while(now != n) {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		} now != n now n {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		} now++ now for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			} int i = 0 ; int i = 0 ; i 0 i < m i m i++ i++ i {
				if(a[i] == now) last++;
			} {
				if(a[i] == now) last++;
			} if(a[i] == now) last++; a[i] == now a[i] a i now last++ last System.out.println(Math.min(first, last)) System.out.println System.out System System.out Math.min(first, last) Math.min Math first last String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[m];
		for(int i = 0 ; i < m ; i++) a[i] = sc.nextInt();
		int first = 0;
		int last = 0;
		int now = x;
		while(now != 0) {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		}
		now = x;
		while(now != n) {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		}
		System.out.println(Math.min(first, last));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[m];
		for(int i = 0 ; i < m ; i++) a[i] = sc.nextInt();
		int first = 0;
		int last = 0;
		int now = x;
		while(now != 0) {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		}
		now = x;
		while(now != n) {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		}
		System.out.println(Math.min(first, last));
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt();
		int[] a = new int[m];
		for(int i = 0 ; i < m ; i++) a[i] = sc.nextInt();
		int first = 0;
		int last = 0;
		int now = x;
		while(now != 0) {
			now--;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) first++;
			}
		}
		now = x;
		while(now != n) {
			now++;
			for(int i = 0 ; i < m ; i++) {
				if(a[i] == now) last++;
			}
		}
		System.out.println(Math.min(first, last));
	}
}
