/* This program reads a number n, forllowed by a number X, followed by a
 * sequence of n numbers, and prints out the number m of the sequence, hwose
 * absolute difference from x is the maximum among all the numbers of the
 * sequence
 */

#include <stdio.h>
#include <stdlib.h>

int main()
{
  int x, n;
  int num, max_num, max = 0;
  printf("Enter number n and x: ");
  scanf("%d %d", &n, &x);
  while (n > 0)	{
    scanf("%d", &num);
    if (max < abs(num - x)) {
      max_num = num;
      max = abs(num - x);
    }
    n--;
  }
  printf("Output: %d\n", max_num);
  return 0;
}

