
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main implements Closeable {

  private InputReader in = new InputReader(System.in);
  private PrintWriter out = new PrintWriter(System.out);

  public void solve() {
    int x = in.ni(), n = in.ni();
    boolean[] forbidden = new boolean[201];
    for (int i = 0; i < n; i++) {
      int next = in.ni();
      forbidden[next] = true;
    }
    int result = 500, diff = 500;
    for (int i = 0; i <= 200; i++) {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    }
    out.println(result);
  }

  @Override
  public void close() throws IOException {
    in.close();
    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int ni() {
      return Integer.parseInt(next());
    }

    public long nl() {
      return Long.parseLong(next());
    }

    public void close() throws IOException {
      reader.close();
    }
  }

  public static void main(String[] args) throws IOException {
    try (Main instance = new Main()) {
      instance.solve();
    }
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.Closeable; Closeable java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main implements Closeable {

  private InputReader in = new InputReader(System.in);
  private PrintWriter out = new PrintWriter(System.out);

  public void solve() {
    int x = in.ni(), n = in.ni();
    boolean[] forbidden = new boolean[201];
    for (int i = 0; i < n; i++) {
      int next = in.ni();
      forbidden[next] = true;
    }
    int result = 500, diff = 500;
    for (int i = 0; i <= 200; i++) {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    }
    out.println(result);
  }

  @Override
  public void close() throws IOException {
    in.close();
    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int ni() {
      return Integer.parseInt(next());
    }

    public long nl() {
      return Long.parseLong(next());
    }

    public void close() throws IOException {
      reader.close();
    }
  }

  public static void main(String[] args) throws IOException {
    try (Main instance = new Main()) {
      instance.solve();
    }
  }
} Main private InputReader in = new InputReader(System.in); in new InputReader(System.in) private PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public void solve() {
    int x = in.ni(), n = in.ni();
    boolean[] forbidden = new boolean[201];
    for (int i = 0; i < n; i++) {
      int next = in.ni();
      forbidden[next] = true;
    }
    int result = 500, diff = 500;
    for (int i = 0; i <= 200; i++) {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    }
    out.println(result);
  } solve {
    int x = in.ni(), n = in.ni();
    boolean[] forbidden = new boolean[201];
    for (int i = 0; i < n; i++) {
      int next = in.ni();
      forbidden[next] = true;
    }
    int result = 500, diff = 500;
    for (int i = 0; i <= 200; i++) {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    }
    out.println(result);
  } int x = in.ni() x in.ni() in.ni in n = in.ni(); n in.ni() in.ni in boolean[] forbidden = new boolean[201]; forbidden new boolean[201] 201 for (int i = 0; i < n; i++) {
      int next = in.ni();
      forbidden[next] = true;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      int next = in.ni();
      forbidden[next] = true;
    } {
      int next = in.ni();
      forbidden[next] = true;
    } int next = in.ni(); next in.ni() in.ni in forbidden[next] = true forbidden[next] forbidden next true int result = 500 result 500 diff = 500; diff 500 for (int i = 0; i <= 200; i++) {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    } int i = 0; int i = 0; i 0 i <= 200 i 200 i++ i++ i {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    } {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    } if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      } !forbidden[i] forbidden[i] forbidden i {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      } int abs = Math.abs(x - i); abs Math.abs(x - i) Math.abs Math x - i x i if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        } abs < diff abs diff {
          result = i;
          diff = abs;
        } result = i result i diff = abs diff abs if (abs == diff) {
          result = Math.min(result, i);
        } abs == diff abs diff {
          result = Math.min(result, i);
        } result = Math.min(result, i) result Math.min(result, i) Math.min Math result i out.println(result) out.println out result @Override
  public void close() throws IOException {
    in.close();
    out.close();
  } close {
    in.close();
    out.close();
  } in.close() in.close in out.close() out.close out public static void main(String[] args) throws IOException {
    try (Main instance = new Main()) {
      instance.solve();
    }
  } main {
    try (Main instance = new Main()) {
      instance.solve();
    }
  } try (Main instance = new Main()) {
      instance.solve();
    } {
      instance.solve();
    } Main instance = new Main() Main instance = new Main() new Main() instance.solve() instance.solve instance String[] args args static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int ni() {
      return Integer.parseInt(next());
    }

    public long nl() {
      return Long.parseLong(next());
    }

    public void close() throws IOException {
      reader.close();
    }
  } InputReader public BufferedReader reader; reader public StringTokenizer tokenizer; tokenizer public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    } InputReader {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    } reader = new BufferedReader(new InputStreamReader(stream), 32768) reader new BufferedReader(new InputStreamReader(stream), 32768) tokenizer = null tokenizer null InputStream stream stream public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    } next {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      } try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        } catch (IOException e) {
          throw new RuntimeException(e);
        } IOException e {
          throw new RuntimeException(e);
        } throw new RuntimeException(e); new RuntimeException(e) {
          tokenizer = new StringTokenizer(reader.readLine());
        } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public int ni() {
      return Integer.parseInt(next());
    } ni {
      return Integer.parseInt(next());
    } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nl() {
      return Long.parseLong(next());
    } nl {
      return Long.parseLong(next());
    } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public void close() throws IOException {
      reader.close();
    } close {
      reader.close();
    } reader.close() reader.close reader Closeable public class Main implements Closeable {

  private InputReader in = new InputReader(System.in);
  private PrintWriter out = new PrintWriter(System.out);

  public void solve() {
    int x = in.ni(), n = in.ni();
    boolean[] forbidden = new boolean[201];
    for (int i = 0; i < n; i++) {
      int next = in.ni();
      forbidden[next] = true;
    }
    int result = 500, diff = 500;
    for (int i = 0; i <= 200; i++) {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    }
    out.println(result);
  }

  @Override
  public void close() throws IOException {
    in.close();
    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int ni() {
      return Integer.parseInt(next());
    }

    public long nl() {
      return Long.parseLong(next());
    }

    public void close() throws IOException {
      reader.close();
    }
  }

  public static void main(String[] args) throws IOException {
    try (Main instance = new Main()) {
      instance.solve();
    }
  }
} public class Main implements Closeable {

  private InputReader in = new InputReader(System.in);
  private PrintWriter out = new PrintWriter(System.out);

  public void solve() {
    int x = in.ni(), n = in.ni();
    boolean[] forbidden = new boolean[201];
    for (int i = 0; i < n; i++) {
      int next = in.ni();
      forbidden[next] = true;
    }
    int result = 500, diff = 500;
    for (int i = 0; i <= 200; i++) {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    }
    out.println(result);
  }

  @Override
  public void close() throws IOException {
    in.close();
    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int ni() {
      return Integer.parseInt(next());
    }

    public long nl() {
      return Long.parseLong(next());
    }

    public void close() throws IOException {
      reader.close();
    }
  }

  public static void main(String[] args) throws IOException {
    try (Main instance = new Main()) {
      instance.solve();
    }
  }
} Main

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main implements Closeable {

  private InputReader in = new InputReader(System.in);
  private PrintWriter out = new PrintWriter(System.out);

  public void solve() {
    int x = in.ni(), n = in.ni();
    boolean[] forbidden = new boolean[201];
    for (int i = 0; i < n; i++) {
      int next = in.ni();
      forbidden[next] = true;
    }
    int result = 500, diff = 500;
    for (int i = 0; i <= 200; i++) {
      if (!forbidden[i]) {
        int abs = Math.abs(x - i);
        if (abs < diff) {
          result = i;
          diff = abs;
        } else if (abs == diff) {
          result = Math.min(result, i);
        }
      }
    }
    out.println(result);
  }

  @Override
  public void close() throws IOException {
    in.close();
    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int ni() {
      return Integer.parseInt(next());
    }

    public long nl() {
      return Long.parseLong(next());
    }

    public void close() throws IOException {
      reader.close();
    }
  }

  public static void main(String[] args) throws IOException {
    try (Main instance = new Main()) {
      instance.solve();
    }
  }
}
