import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        int P[] = new int[N];
        for (int i = 0; i < N; i++) {
            P[i] = s.nextInt();
        }
        int Q[] = new int[102];
        Arrays.sort(P);
        int p = 0;
        for (int i = 0; i <= 101; i++) {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        }
        int ans = 0;
        int d = 200;
        int d_tmp = 0;
        for (int i = 0; i <= 101; i++) {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        }
        System.out.println(ans);
        s.close();
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        int P[] = new int[N];
        for (int i = 0; i < N; i++) {
            P[i] = s.nextInt();
        }
        int Q[] = new int[102];
        Arrays.sort(P);
        int p = 0;
        for (int i = 0; i <= 101; i++) {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        }
        int ans = 0;
        int d = 200;
        int d_tmp = 0;
        for (int i = 0; i <= 101; i++) {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        }
        System.out.println(ans);
        s.close();
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        int P[] = new int[N];
        for (int i = 0; i < N; i++) {
            P[i] = s.nextInt();
        }
        int Q[] = new int[102];
        Arrays.sort(P);
        int p = 0;
        for (int i = 0; i <= 101; i++) {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        }
        int ans = 0;
        int d = 200;
        int d_tmp = 0;
        for (int i = 0; i <= 101; i++) {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        }
        System.out.println(ans);
        s.close();
    } main {
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        int P[] = new int[N];
        for (int i = 0; i < N; i++) {
            P[i] = s.nextInt();
        }
        int Q[] = new int[102];
        Arrays.sort(P);
        int p = 0;
        for (int i = 0; i <= 101; i++) {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        }
        int ans = 0;
        int d = 200;
        int d_tmp = 0;
        for (int i = 0; i <= 101; i++) {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        }
        System.out.println(ans);
        s.close();
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) int X = s.nextInt(); X s.nextInt() s.nextInt s int N = s.nextInt(); N s.nextInt() s.nextInt s int P[] = new int[N]; P new int[N] N for (int i = 0; i < N; i++) {
            P[i] = s.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            P[i] = s.nextInt();
        } {
            P[i] = s.nextInt();
        } P[i] = s.nextInt() P[i] P i s.nextInt() s.nextInt s int Q[] = new int[102]; Q new int[102] 102 Arrays.sort(P) Arrays.sort Arrays P int p = 0; p 0 for (int i = 0; i <= 101; i++) {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        } int i = 0; int i = 0; i 0 i <= 101 i 101 i++ i++ i {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        } {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        } if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            } p < N p N {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                } P[p] == i P[p] P p i {
                    p++;
                } p++ p {
                    Q[i] = i;
                } Q[i] = i Q[i] Q i i {
                Q[i] = i;
            } Q[i] = i Q[i] Q i i int ans = 0; ans 0 int d = 200; d 200 int d_tmp = 0; d_tmp 0 for (int i = 0; i <= 101; i++) {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        } int i = 0; int i = 0; i 0 i <= 101 i 101 i++ i++ i {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        } {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        } d_tmp = X - Q[i] d_tmp X - Q[i] X Q[i] Q i if (d_tmp < 0) {
                d_tmp *= -1;
            } d_tmp < 0 d_tmp 0 {
                d_tmp *= -1;
            } d_tmp *= -1 d_tmp -1 1 if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            } d > d_tmp d d_tmp {
                d = d_tmp;
                ans = Q[i];
            } d = d_tmp d d_tmp ans = Q[i] ans Q[i] Q i System.out.println(ans) System.out.println System.out System System.out ans s.close() s.close s String[] args args public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        int P[] = new int[N];
        for (int i = 0; i < N; i++) {
            P[i] = s.nextInt();
        }
        int Q[] = new int[102];
        Arrays.sort(P);
        int p = 0;
        for (int i = 0; i <= 101; i++) {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        }
        int ans = 0;
        int d = 200;
        int d_tmp = 0;
        for (int i = 0; i <= 101; i++) {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        }
        System.out.println(ans);
        s.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        int P[] = new int[N];
        for (int i = 0; i < N; i++) {
            P[i] = s.nextInt();
        }
        int Q[] = new int[102];
        Arrays.sort(P);
        int p = 0;
        for (int i = 0; i <= 101; i++) {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        }
        int ans = 0;
        int d = 200;
        int d_tmp = 0;
        for (int i = 0; i <= 101; i++) {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        }
        System.out.println(ans);
        s.close();
    }
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int X = s.nextInt();
        int N = s.nextInt();
        int P[] = new int[N];
        for (int i = 0; i < N; i++) {
            P[i] = s.nextInt();
        }
        int Q[] = new int[102];
        Arrays.sort(P);
        int p = 0;
        for (int i = 0; i <= 101; i++) {
            if (p < N) {
                if (P[p] == i) {
                    p++;
                } else {
                    Q[i] = i;
                }
            } else {
                Q[i] = i;
            }
        }
        int ans = 0;
        int d = 200;
        int d_tmp = 0;
        for (int i = 0; i <= 101; i++) {
            d_tmp = X - Q[i];
            if (d_tmp < 0) {
                d_tmp *= -1;
            }
            if (d > d_tmp) {
                d = d_tmp;
                ans = Q[i];
            }
        }
        System.out.println(ans);
        s.close();
    }
}