// ternary operation
#[allow(unused_macros)]
macro_rules! _if {
  ($_test:expr, $_then:expr, $_else:expr) => {
    if $_test { $_then } else { $_else }
  };
  ($_test:expr, $_pat:pat, $_then:expr, $_else:expr) => {
    match $_test {
      $_pat => $_then,
      _     => $_else
    }
  };
}

use std::io::{ stdin, stdout, Write };
use my::WriteWith;

use std::io::{ BufReader, BufWriter };

#[inline(always)]
fn abc109_c() {
  let stdin  = stdin();
  let stdout = stdout();
  let mut scanner = my::Scanner::with_capacity(12, BufReader::new(stdin.lock()));
  let mut writer = BufWriter::new(stdout.lock());
  let mut itoa = my::ItoA::with_capacity(10);

  let n = scanner.uint_until::<usize>(my::SP);
  let x = scanner.int_until::<i32>(my::LF);

  let mut ans = 0;
  for _ in 0..n - 1 {
    ans = my::gcd((scanner.int_until::<i32>(my::SP) - x).abs(), ans);
  }
  ans = my::gcd((scanner.int_until::<i32>(my::LF) - x).abs(), ans);

  writer.write_with(itoa.from_i32(ans), b"\n").unwrap();
  writer.flush().unwrap();
}

fn main() {
  abc109_c();
}

//------------------------------------------------------------------------
mod my {
  #[derive(Debug)]
  pub struct Scanner<R> {
    reader: R,
    buf   : Vec<u8>,
  }

  impl<R> Scanner<R>
    where R: BufRead
  {
    #[allow(dead_code)]
    #[inline(always)]
    pub fn with_capacity(cap: usize, reader: R) -> Self {
      Scanner {
        reader: reader,
        buf   : Vec::with_capacity(cap),
      }
    }

    #[allow(dead_code)]
    #[inline(always)]
    fn read_until(&mut self, delim: u8) {
      self.buf.clear();
      let mut len = self.reader
                        .read_until(delim, &mut self.buf).unwrap();
      if len == 0 {
        return;
      }

      len -= 1;
      if self.buf[len] == delim {
        self.buf.truncate(len);
      }
    }

    #[allow(dead_code)]
    #[inline(always)]
    pub fn uint_until<T>(&mut self, delim: u8) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      self.read_until(delim);
      atoui(&self.buf)
    }

    #[allow(dead_code)]
    #[inline(always)]
    pub fn int_until<T>(&mut self, delim: u8) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      self.read_until(delim);
      atoi(&self.buf)
    }
  }

  #[allow(dead_code)]
  #[inline(always)]
  pub fn uint<T, R>(reader: &mut R, delim: u8, buf: &mut Vec<u8>) -> T
    where R: BufRead,
          T: Add<Output=T> +
             Sub<Output=T> +
             Mul<Output=T> +
             Default +
             From<u8> +
             Debug
  {
    read_until(reader, delim, buf);
    atoui::<T>(&buf)
  }

  #[allow(dead_code)]
  #[inline(always)]
  pub fn int<T, R>(reader: &mut R, delim: u8, buf: &mut Vec<u8>) -> T
    where R: BufRead,
          T: Add<Output=T> +
             Sub<Output=T> +
             Mul<Output=T> +
             Neg<Output=T> +
             Default +
             From<u8> +
             Debug
  {
    read_until(reader, delim, buf);
    atoi::<T>(&buf)
  }

  #[allow(dead_code)]
  #[inline(always)]
  pub fn read_until<R>(reader: &mut R, delim: u8, buf: &mut Vec<u8>)
    where R: BufRead
  {
    buf.clear();
    reader.read_until(delim, buf).unwrap();

    let len = buf.len() - 1;
    if buf[len] == delim {
      buf.truncate(len);
    }
  }

  #[allow(dead_code)]
  #[inline(always)]
  pub fn atoui<T>(s: &[u8]) -> T
    where T: Add<Output=T> +
             Sub<Output=T> +
             Mul<Output=T> +
             Default +
             From<u8> +
             Debug
  {
    let mut n = T::default();
    if s.len() == 0 {
      return n;
    }

    let mut i = 0;
    if s[i] == PLUS_SIGN {
      i += 1;
    }

    for b in &s[i..] {
      n = (n * T::from(10)) + T::from(b - ASCII_0);
    }

    n
  }

  #[allow(dead_code)]
  #[inline(always)]
  pub fn atoi<T>(s: &[u8]) -> T
    where T: Add<Output=T> +
             Sub<Output=T> +
             Mul<Output=T> +
             Neg<Output=T> +
             Default +
             From<u8> +
             Debug
  {
    let mut n = T::default();
    if s.len() == 0 {
      return n;
    }

    let mut i = 0;
    let mut negative = false;
    if s[i] == MINUS_SIGN {
      negative = true;
      i += 1;
    } else if s[i] == PLUS_SIGN {
      i += 1;
    }

    for b in &s[i..] {
      n = (n * T::from(10)) + T::from(b - ASCII_0);
    }

    _if!(negative,
      n.neg(),
      n)
  }






  use std::hash::Hasher;
  use std::hash::BuildHasher;

  pub struct MyHasher(u64);

  impl Default for MyHasher {

    fn default() -> Self {
      MyHasher(0x00)
    }
  }

  impl BuildHasher for MyHasher {
    type Hasher = MyHasher;


    fn build_hasher(&self) -> Self::Hasher {
      Self::Hasher::default()
    }
  }

  impl Hasher for MyHasher {

    fn finish(&self) -> u64 {
      self.0
    }


    fn write(&mut self, bytes: &[u8]) {
      self.0 = 0;
      for i in 0..bytes.len() {
        self.0 ^= (bytes[i] as u64) << (8 * (i % 8));
      }
    }
  }

  //----------------------------------------------------------------------
  use std::io::{ self, BufRead, BufReader, Write, BufWriter };
  use std::fmt::Debug;
  use std::ops::{ Add, Sub, Mul, Div, Rem, Neg };
//  use std::str::{ self, FromStr };
  use std::mem;

  const PLUS_SIGN : u8 = b'+';
  const MINUS_SIGN: u8 = b'-';
  const ASCII_0   : u8 = b'0';
  const ASCII_9   : u8 = b'9';

  pub const SP    : u8 = b' ';
  pub const LF    : u8 = b'\n';

  //----------------------------------------------------------------------
  #[allow(dead_code)]

  pub fn floor<T>(dividend: T, divisor: T) -> T
    where T: Add<Output=T> +
             Sub<Output=T> +
             Div<Output=T> +
             Copy +
             Default +
             Debug
  {
    dividend / divisor
  }

  #[allow(dead_code)]

  pub fn ceil<T>(dividend: T, divisor: T) -> T
    where T: Add<Output=T> +
             Sub<Output=T> +
             Div<Output=T> +
             Copy +
             Default +
             From<u8> +
             Debug
  {
    (dividend + divisor - T::from(1)) / divisor
  }

  //----------------------------------------------------------------------
  #[allow(dead_code)]

  pub fn rotate_right<T>(ary: &mut [T])
    where T: Copy +
             Debug
  {
    if ary.len() <= 1 {
      return;
    }

    let len = ary.len() - 1;
    let tmp = ary[len];
    for i in 0..len {
      ary[len - i] = ary[len - i - 1];
    }
    ary[0] = tmp;
  }

  #[allow(dead_code)]

  pub fn rotate_left<T>(ary: &mut [T])
    where T: Copy +
             Debug
  {
    if ary.len() <= 1 {
      return;
    }

    let len = ary.len() - 1;
    let tmp = ary[0];
    for i in 0..len {
      ary[i] = ary[i + 1];
    }
    ary[len] = tmp;
  }

  //----------------------------------------------------------------------
  #[allow(dead_code)]
  #[inline(always)]
  pub fn gcd<T>(x: T, y: T) -> T
    where T: Rem<Output=T> +
             Default +
             PartialEq +
             Copy +
             Debug
  {
    _if!(y == T::default(),
      x,
      gcd(y, x % y))
  }

  //----------------------------------------------------------------------
  #[allow(dead_code)]

  pub fn intersection<T>(mut x: (T, T), mut y: (T, T)) -> Option<(T, T)>
    where T: PartialOrd +
             Copy +
             Debug
  {
    if x.0 > x.1 {
      mem::swap(&mut x.0, &mut x.1);
    }
    if y.0 > y.1 {
      mem::swap(&mut y.0, &mut y.1);
    }

    if x.0 >= y.1 || x.1 <= y.0 {
      return None;
    }

    if x.0 < y.0 {
      x.0 = y.0;
    }
    if x.1 > y.1 {
      x.1 = y.1;
    }

    Some(x)
  }

  //----------------------------------------------------------------------
  #[allow(dead_code)]

  pub fn is_ascii_digit(b: u8) -> bool {
    _if!(b >= ASCII_0 && b <= ASCII_9,
      true,
      false)
  }

  #[allow(dead_code)]

  pub fn is_ascii_uppercase(b: u8) -> bool {
    _if!(b >= b'A' && b <= b'Z',
      true,
      false)
  }

  #[allow(dead_code)]

  pub fn is_ascii_lowercase(b: u8) -> bool {
    _if!(b >= b'a' && b <= b'z',
      true,
      false)
  }

  #[allow(dead_code)]

  pub fn is_ascii_alphabetic(b: u8) -> bool {
    _if!(is_ascii_uppercase(b) || is_ascii_lowercase(b),
      true,
      false)
  }

  #[allow(dead_code)]

  pub fn to_ascii_lowercase(b: u8) -> u8 {
    _if!(is_ascii_uppercase(b),
      b + 0x20,
      b)
  }

  #[allow(dead_code)]

  pub fn to_ascii_uppercase(b: u8) -> u8 {
    _if!(is_ascii_lowercase(b),
      b - 0x20,
      b)
  }

  //----------------------------------------------------------------------
  pub trait WriteWith {
    fn write_with(&mut self, buf: &[u8], delim: &[u8]) -> io::Result<usize>;
  }

  impl<W> WriteWith for BufWriter<W>
    where W: io::Write
  {
    #[allow(dead_code)]
    #[inline(always)]
    fn write_with(&mut self, buf: &[u8], delim: &[u8]) -> io::Result<usize>
    {
      Ok(self.write(buf)? + self.write(delim)?)
    }
  } // impl<W> WriteWith for BufWriter<W>

  //----------------------------------------------------------------------
  macro_rules! pub_fn_ItoA_from_ty {
    (uint, $($name:ident => $_type:ty),*) => {$(
      #[allow(dead_code)]
      #[inline(always)]
      pub fn $name(&mut self, mut n: $_type) -> &[u8] {
        self.buf.clear();
        if n == 0 {
          self.buf.push(ASCII_0);
          return self.buf.as_slice();
        }

        while n > 0 {
          self.buf.push((n % 10) as u8 + ASCII_0);
          n /= 10;
        }
        self.buf.reverse();
        self.buf.as_slice()
      }
    )*};

    (int, $($name:ident => $_type:ty),*) => {$(
      #[allow(dead_code)]
      #[inline(always)]
      pub fn $name(&mut self, mut n: $_type) -> &[u8] {
        self.buf.clear();
        if n == 0 {
          self.buf.push(ASCII_0);
          return self.buf.as_slice();
        }

        let mut negative = false;
        if n.is_negative() {
          negative = true;
          n = n.abs();
        }

        while n > 0 {
          self.buf.push((n % 10) as u8 + ASCII_0);
          n /= 10;
        }
        if negative {
          self.buf.push(MINUS_SIGN);
        }
        self.buf.reverse();
        self.buf.as_slice()
      }
    )*};
  }

  #[derive(Debug)]
  pub struct ItoA {
    buf: Vec<u8>,
  }

  impl ItoA {
    #[allow(dead_code)]
    #[inline(always)]
    pub fn new() -> Self {
      ItoA {
        buf: Vec::new(),
      }
    }

    #[allow(dead_code)]
    #[inline(always)]
    pub fn with_capacity(cap: usize) -> Self {
      ItoA {
        buf: Vec::with_capacity(cap),
      }
    }

    pub_fn_ItoA_from_ty!(
      uint,
      from_usize => usize,
      from_u8    => u8,
      from_u16   => u16,
      from_u32   => u32,
      from_u64   => u64
    );

    pub_fn_ItoA_from_ty!(
      int,
      from_isize => isize,
      from_i8    => i8,
      from_i16   => i16,
      from_i32   => i32,
      from_i64   => i64
    );
  } // impl ItoA

  //----------------------------------------------------------------------
  #[allow(dead_code)]
  #[inline(always)]
  pub fn rw<R, W>(cap: usize, r: R, w: W) -> (Scanner<BufReader<R>>, BufWriter<W>)
    where R: BufRead,
          W: io::Write
  {
    (
      Scanner::with_capacity(cap, BufReader::new(r)),
      BufWriter::new(w)
    )
  }

  #[allow(dead_code)]

  pub fn r<R>(cap: usize, r: R) -> Scanner<BufReader<R>>
    where R: BufRead
  {
    Scanner::with_capacity(cap, BufReader::new(r))
  }

  #[allow(dead_code)]

  pub fn w<W>(w: W) -> BufWriter<W>
    where W: io::Write
  {
    BufWriter::new(w)
  }

/*
  //----------------------------------------------------------------------
  #[derive(Debug)]
  pub struct Scanner<R> {
    reader: R,
    buf   : Vec<u8>,
  }

  impl<R> Scanner<R>
    where R: BufRead
  {
    #[allow(dead_code)]

    pub fn new(reader: R) -> Self {
      Scanner {
        reader: reader,
        buf   : Vec::new(),
      }
    }

    #[allow(dead_code)]
    #[inline(always)]
    pub fn with_capacity(cap: usize, reader: R) -> Self {
      Scanner {
        reader: reader,
        buf   : Vec::with_capacity(cap),
      }
    }

    //--------------------------------------------------------------------

    #[allow(dead_code)]
    #[inline(always)]
    pub fn into_inner(self) -> R {
      self.reader
    }

    #[inline(always)]
    fn read_until(&mut self, delim: u8) {
      self.buf.clear();
      let mut len = self.reader
                      .read_until(delim, &mut self.buf)
                      .expect(&format!("read_until(): {}", line!()));
      if len == 0 {
        return;
      }

      len -= 1;
      if self.buf[len] == delim {
        self.buf.truncate(len);
      }
    }

    #[allow(dead_code)]

    fn read_until_delim(&mut self) {
      let mut buf: [u8; 1] = [0; 1];

      self.buf.clear();
      while self.reader
              .read(&mut buf)
              .expect(&format!("read(): {}", line!())) != 0 &&
            buf[0] != SP &&
            buf[0] != LF
      {
        self.buf.push(buf[0]);
      }
    }

    //--------------------------------------------------------------------
    // s -> n
    #[allow(dead_code)]

    pub fn parse_until<T>(&mut self, delim: u8) -> T
      where T: FromStr + Debug,
            <T as FromStr>::Err: Debug
    {
      self.read_until(delim);
      unsafe { str::from_utf8_unchecked(&self.buf) }
        .parse()
        .unwrap()
    }

    //--------------------------------------------------------------------
    #[allow(dead_code)]
    #[inline(always)]
    pub fn byte_until(&mut self, delim: u8) -> Vec<u8> {
      self.read_until(delim);
      self.buf.clone()
    }

    #[allow(dead_code)]
    #[inline(always)]
    pub fn string_until(&mut self, delim: u8) -> String {
      unsafe { String::from_utf8_unchecked(self.byte_until(delim)) }
    }

    //--------------------------------------------------------------------
    // s -> n
    #[allow(dead_code)]
    #[inline(always)]
    pub fn uint_until<T>(&mut self, delim: u8) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      self.read_until(delim);
      atoui(&self.buf)
    }

    // s -> n
    #[allow(dead_code)]
    #[inline(always)]
    pub fn int_until<T>(&mut self, delim: u8) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      self.read_until(delim);
      atoi(&self.buf)
    }

    // s -> n
    #[allow(dead_code)]

    pub fn int_1<T>(&mut self) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      self.read_until_delim();
      let mut n = T::default();
      if self.buf.len() == 0 {
        return n;
      }

      let mut i = 0;
      let mut negative = false;
      if self.buf[i] == MINUS_SIGN {
        negative = true;
        i += 1;
      } else if self.buf[i] == PLUS_SIGN {
        i += 1;
      }

      for b in &self.buf[i..] {
        n = (n * T::from(10)) + T::from(b - ASCII_0);
      }

      _if!(negative,
        n.neg(),
        n)
    }

    // s -> n
    #[allow(dead_code)]

    pub fn int<T>(&mut self) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      let mut buf: [u8; 1] = [0; 1];

      if self.reader
             .read(&mut buf)
             .expect(&format!("read(): {}", line!())) == 0 ||
         buf[0] == SP ||
         buf[0] == LF
      {
        panic!("int_until_x(): {}", line!());
      }

      let mut n = T::default();

      let mut negative = false;
      if buf[0] == MINUS_SIGN {
        negative = true;
      } else if buf[0] == PLUS_SIGN {
        // do nothing
      } else {
        n = (n * T::from(10)) + T::from(buf[0] - ASCII_0);
      }

      loop {
        self.reader
            .read(&mut buf)
            .expect(&format!("read(): {}", line!()));
        if buf[0] == SP || buf[0] == LF {
          break;
        } else {
          n = (n * T::from(10)) + T::from(buf[0] - ASCII_0);
        }
      }

      // while self.reader
      //         .read(&mut buf)
      //         .expect(&format!("read(): {}", line!())) != 0 &&
      //       buf[0] != SP &&
      //       buf[0] != LF
      // {
      //   n = (n * T::from(10)) + T::from(buf[0] - ASCII_0);
      // }

      _if!(negative,
        n.neg(),
        n)
    }

    //--------------------------------------------------------------------
    #[allow(dead_code)]

    pub fn uint_to_end<T, F>(&mut self, n: usize, delim: u8, mut init: T, mut func: F) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug,
            F: ::std::ops::FnMut(T, T) -> T
    {
      for _ in 0..n - 1 {
        init = func(init, self.uint_until(delim));
      }
      func(init, self.uint_until(LF))
    }

    #[allow(dead_code)]

    pub fn int_to_end<T, F>(&mut self, n: usize, delim: u8, mut init: T, mut func: F) -> T
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug,
            F: ::std::ops::FnMut(T, T) -> T
    {
      for _ in 0..n - 1 {
        init = func(init, self.int_until(delim));
      }
      func(init, self.int_until(LF))
    }

    #[allow(dead_code)]

    pub fn uint_n<T, F>(&mut self, n: usize, delim: u8, mut func: F)
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug,
            F: ::std::ops::FnMut(T)
    {
      for _ in 0..n {
        func(self.uint_until(delim));
      }
    }

    #[allow(dead_code)]

    pub fn int_n<T, F>(&mut self, n: usize, delim: u8, mut func: F)
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug,
            F: ::std::ops::FnMut(T)
    {
      for _ in 0..n {
        func(self.int_until(delim));
      }
    }

    //--------------------------------------------------------------------
    #[allow(dead_code)]

    pub fn uint_vec<T>(&mut self, n: usize, delim: u8) -> Vec<T>
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      let mut vec = Vec::with_capacity(n);
      for _ in 0..n - 1 {
        vec.push(self.uint_until(delim));
      }
      vec.push(self.uint_until(LF));
      vec
    }

    #[allow(dead_code)]

    pub fn int_vec<T>(&mut self, n: usize, delim: u8) -> Vec<T>
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      let mut vec = Vec::with_capacity(n);
      for _ in 0..n - 1 {
        vec.push(self.int_until(delim));
      }
      vec.push(self.int_until(LF));
      vec
    }

    // horizontal
    //
    // N
    // s1 s2 s3, ..., sN -> [n1, n2, n3, ..., nN]
    #[allow(dead_code)]

    pub fn uint_vec_h<T>(&mut self) -> Vec<T>
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      let n: usize = self.uint_until(LF);
      self.uint_vec(n, SP)
    }

    // horizontal
    //
    // N
    // s1 s2 s3, ..., sN -> [n1, n2, n3, ..., nN]
    #[allow(dead_code)]

    pub fn int_vec_h<T>(&mut self) -> Vec<T>
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      let n: usize = self.uint_until(LF);
      self.int_vec(n, SP)
    }

    // N M
    // s11 s12 s13 ... s1M
    // s21 s22 s23 ... s2M
    // s31 s32 s33 ... s3M
    //   :
    // sN1 sN2 sN3 ... sNM
    // -> [
    //      [n11, n12, n13, ..., n1M],
    //      [n21, n22, n23, ..., n2M],
    //      [n31, n32, n33, ..., n3M],
    //          :
    //      [nN1, nN2, nN3, ..., nNM],
    //    ]
    #[allow(dead_code)]

    pub fn uint_vec2<T>(&mut self, n: usize, m: usize) -> Vec<Vec<T>>
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      let mut vec = Vec::with_capacity(n);
      for _ in 0..n {
        vec.push(self.uint_vec(m, SP));
      }
      vec
    }

    // N M
    // s11 s12 s13 ... s1M
    // s21 s22 s23 ... s2M
    // s31 s32 s33 ... s3M
    //   :
    // sN1 sN2 sN3 ... sNM
    // -> [
    //      [n11, n12, n13, ..., n1M],
    //      [n21, n22, n23, ..., n2M],
    //      [n31, n32, n33, ..., n3M],
    //          :
    //      [nN1, nN2, nN3, ..., nNM],
    //    ]
    #[allow(dead_code)]

    pub fn int_vec2<T>(&mut self, n: usize, m: usize) -> Vec<Vec<T>>
      where T: Add<Output=T> +
               Sub<Output=T> +
               Mul<Output=T> +
               Neg<Output=T> +
               Default +
               From<u8> +
               Debug
    {
      let mut vec = Vec::with_capacity(n);
      for _ in 0..n {
        vec.push(self.int_vec(m, SP));
      }
      vec
    }

  } // impl<R> Scanner<R>
*/

} // mod my


Measured memory_bytes: 4352