import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = 0;
    int M = 0;
    int X = 0;

    while (N < 1 || N > 100) {
      N = sc.nextInt();
    }

    while (M < 1 || M > 100) {
      M = sc.nextInt();
    }

    while (X < 1 || X > N - 1) {
      X = sc.nextInt();
    }

    int[] A = new int[M];
    int s;

    for (int i = 0; i <= M - 1; i++) {
      s = 0;

      while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      }
      A[i] = s;
    }

    int X2 =X;
    int  c1 = 0;

      while (X2 <= N - 1) {
      for (int ii = 0; ii <= M - 1; ii++) {
        if (A[ii] == X2) {
          c1++;
        }
      }
      X2++;
    }

    X2 =X;
    int  c2 = 0;

      while (X2 >= 0) {
      for (int iii = 0; iii <= M - 1; iii++) {
        if (A[iii] == X2) {
          c2++;
        }
      }
      X2--;
    }

    if (c1 < c2) {
      System.out.println(c1);
    }else {
      System.out.println(c2);
    }


    }
  } import java.util.Scanner; Scanner java.util class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = 0;
    int M = 0;
    int X = 0;

    while (N < 1 || N > 100) {
      N = sc.nextInt();
    }

    while (M < 1 || M > 100) {
      M = sc.nextInt();
    }

    while (X < 1 || X > N - 1) {
      X = sc.nextInt();
    }

    int[] A = new int[M];
    int s;

    for (int i = 0; i <= M - 1; i++) {
      s = 0;

      while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      }
      A[i] = s;
    }

    int X2 =X;
    int  c1 = 0;

      while (X2 <= N - 1) {
      for (int ii = 0; ii <= M - 1; ii++) {
        if (A[ii] == X2) {
          c1++;
        }
      }
      X2++;
    }

    X2 =X;
    int  c2 = 0;

      while (X2 >= 0) {
      for (int iii = 0; iii <= M - 1; iii++) {
        if (A[iii] == X2) {
          c2++;
        }
      }
      X2--;
    }

    if (c1 < c2) {
      System.out.println(c1);
    }else {
      System.out.println(c2);
    }


    }
  } Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = 0;
    int M = 0;
    int X = 0;

    while (N < 1 || N > 100) {
      N = sc.nextInt();
    }

    while (M < 1 || M > 100) {
      M = sc.nextInt();
    }

    while (X < 1 || X > N - 1) {
      X = sc.nextInt();
    }

    int[] A = new int[M];
    int s;

    for (int i = 0; i <= M - 1; i++) {
      s = 0;

      while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      }
      A[i] = s;
    }

    int X2 =X;
    int  c1 = 0;

      while (X2 <= N - 1) {
      for (int ii = 0; ii <= M - 1; ii++) {
        if (A[ii] == X2) {
          c1++;
        }
      }
      X2++;
    }

    X2 =X;
    int  c2 = 0;

      while (X2 >= 0) {
      for (int iii = 0; iii <= M - 1; iii++) {
        if (A[iii] == X2) {
          c2++;
        }
      }
      X2--;
    }

    if (c1 < c2) {
      System.out.println(c1);
    }else {
      System.out.println(c2);
    }


    } main {
    Scanner sc = new Scanner(System.in);

    int N = 0;
    int M = 0;
    int X = 0;

    while (N < 1 || N > 100) {
      N = sc.nextInt();
    }

    while (M < 1 || M > 100) {
      M = sc.nextInt();
    }

    while (X < 1 || X > N - 1) {
      X = sc.nextInt();
    }

    int[] A = new int[M];
    int s;

    for (int i = 0; i <= M - 1; i++) {
      s = 0;

      while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      }
      A[i] = s;
    }

    int X2 =X;
    int  c1 = 0;

      while (X2 <= N - 1) {
      for (int ii = 0; ii <= M - 1; ii++) {
        if (A[ii] == X2) {
          c1++;
        }
      }
      X2++;
    }

    X2 =X;
    int  c2 = 0;

      while (X2 >= 0) {
      for (int iii = 0; iii <= M - 1; iii++) {
        if (A[iii] == X2) {
          c2++;
        }
      }
      X2--;
    }

    if (c1 < c2) {
      System.out.println(c1);
    }else {
      System.out.println(c2);
    }


    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = 0; N 0 int M = 0; M 0 int X = 0; X 0 while (N < 1 || N > 100) {
      N = sc.nextInt();
    } N < 1 || N > 100 N < 1 N 1 N > 100 N 100 {
      N = sc.nextInt();
    } N = sc.nextInt() N sc.nextInt() sc.nextInt sc while (M < 1 || M > 100) {
      M = sc.nextInt();
    } M < 1 || M > 100 M < 1 M 1 M > 100 M 100 {
      M = sc.nextInt();
    } M = sc.nextInt() M sc.nextInt() sc.nextInt sc while (X < 1 || X > N - 1) {
      X = sc.nextInt();
    } X < 1 || X > N - 1 X < 1 X 1 X > N - 1 X N - 1 N 1 {
      X = sc.nextInt();
    } X = sc.nextInt() X sc.nextInt() sc.nextInt sc int[] A = new int[M]; A new int[M] M int s; s for (int i = 0; i <= M - 1; i++) {
      s = 0;

      while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      }
      A[i] = s;
    } int i = 0; int i = 0; i 0 i <= M - 1 i M - 1 M 1 i++ i++ i {
      s = 0;

      while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      }
      A[i] = s;
    } {
      s = 0;

      while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      }
      A[i] = s;
    } s = 0 s 0 while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      } s < 1 || s > N -1 || s == X s < 1 || s > N -1 || s == X s < 1 s 1 s > N -1 s N -1 N 1 s == X s X {
        s = sc.nextInt();
      } s = sc.nextInt() s sc.nextInt() sc.nextInt sc A[i] = s A[i] A i s int X2 =X; X2 X int  c1 = 0; c1 0 while (X2 <= N - 1) {
      for (int ii = 0; ii <= M - 1; ii++) {
        if (A[ii] == X2) {
          c1++;
        }
      }
      X2++;
    } X2 <= N - 1 X2 N - 1 N 1 {
      for (int ii = 0; ii <= M - 1; ii++) {
        if (A[ii] == X2) {
          c1++;
        }
      }
      X2++;
    } for (int ii = 0; ii <= M - 1; ii++) {
        if (A[ii] == X2) {
          c1++;
        }
      } int ii = 0; int ii = 0; ii 0 ii <= M - 1 ii M - 1 M 1 ii++ ii++ ii {
        if (A[ii] == X2) {
          c1++;
        }
      } {
        if (A[ii] == X2) {
          c1++;
        }
      } if (A[ii] == X2) {
          c1++;
        } A[ii] == X2 A[ii] A ii X2 {
          c1++;
        } c1++ c1 X2++ X2 X2 =X X2 X int  c2 = 0; c2 0 while (X2 >= 0) {
      for (int iii = 0; iii <= M - 1; iii++) {
        if (A[iii] == X2) {
          c2++;
        }
      }
      X2--;
    } X2 >= 0 X2 0 {
      for (int iii = 0; iii <= M - 1; iii++) {
        if (A[iii] == X2) {
          c2++;
        }
      }
      X2--;
    } for (int iii = 0; iii <= M - 1; iii++) {
        if (A[iii] == X2) {
          c2++;
        }
      } int iii = 0; int iii = 0; iii 0 iii <= M - 1 iii M - 1 M 1 iii++ iii++ iii {
        if (A[iii] == X2) {
          c2++;
        }
      } {
        if (A[iii] == X2) {
          c2++;
        }
      } if (A[iii] == X2) {
          c2++;
        } A[iii] == X2 A[iii] A iii X2 {
          c2++;
        } c2++ c2 X2-- X2 if (c1 < c2) {
      System.out.println(c1);
    }else {
      System.out.println(c2);
    } c1 < c2 c1 c2 {
      System.out.println(c1);
    } System.out.println(c1) System.out.println System.out System System.out c1 {
      System.out.println(c2);
    } System.out.println(c2) System.out.println System.out System System.out c2 String[] args args
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = 0;
    int M = 0;
    int X = 0;

    while (N < 1 || N > 100) {
      N = sc.nextInt();
    }

    while (M < 1 || M > 100) {
      M = sc.nextInt();
    }

    while (X < 1 || X > N - 1) {
      X = sc.nextInt();
    }

    int[] A = new int[M];
    int s;

    for (int i = 0; i <= M - 1; i++) {
      s = 0;

      while (s < 1 || s > N -1 || s == X) {
        s = sc.nextInt();
      }
      A[i] = s;
    }

    int X2 =X;
    int  c1 = 0;

      while (X2 <= N - 1) {
      for (int ii = 0; ii <= M - 1; ii++) {
        if (A[ii] == X2) {
          c1++;
        }
      }
      X2++;
    }

    X2 =X;
    int  c2 = 0;

      while (X2 >= 0) {
      for (int iii = 0; iii <= M - 1; iii++) {
        if (A[iii] == X2) {
          c2++;
        }
      }
      X2--;
    }

    if (c1 < c2) {
      System.out.println(c1);
    }else {
      System.out.println(c2);
    }


    }
  }