Language: C++

#define FULL_OPEN 
//#define DEBUG
#define STAY
#ifdef FULL_OPEN
//include
//-------------------------
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <chrono>
#include <complex>
#include <condition_variable>
#include <deque>
#include <exception>
#include <forward_list>
#include <fstream>
#include <functional>
#include <future>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

//conversion
//-----------------------
inline int toInt(string s) { int v;istringstream sin(s);sin >> v;return v; }
template<class T>inline string toString(T x) { ostringstream sout;sout << x;return sout.str(); }

//math
//-----------------------
template<class T>inline T sqr(T x) { return x * x; }

//using
//-----------------------
using ll = long long;
using ull = unsigned long long;
using ld = long double;

using pii = pair<int, int>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vii = vector<pair<int, int > >;
using vll = vector<ll>;
using vld = vector<ld>;
using vvi = vector<vi>;
using vvii = vector<vii>;
using vvll = vector<vll>;
using vs = vector<string>;
using mii = map<int, int>;
using si = set<int>;
using sll = set<ll>;

//function
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

enum priority_code {
	fs,
	sf,
};
template<class T = void, priority_code t = fs>
struct greater_pair {
	constexpr bool operator()(const T& _Left, const T& _Right)const {
		if (t == sf)
			return (_Left.second > _Right.second ||
			(!(_Right.second > _Left.second) && _Left.first > _Right.first));
		else
			return (_Left.first > _Right.first ||
			(!(_Right.first > _Left.first) && _Left.second > _Right.second));
	}
};
template<class T = void, priority_code t = fs>
struct less_pair {
	constexpr bool operator()(const T& _Left, const T& _Right)const {
		if (t == sf)
			return (_Left.second < _Right.second ||
			(!(_Right.second < _Left.second) && _Left.first < _Right.first));
		else
			return (_Left.first < _Right.first ||
			(!(_Right.first < _Left.first) && _Left.second < _Right.second));
	}
};


//container util
//-----------------------
#define all(con)	begin(con),end(con)
#define rall(con)	rbegin(con),rend(con)
#define call(con)	cbegin(con),cend(con)
#define crall(con)	crbegin(con),crend(con)
#define whole(func,con,...) ([&](decltype((con)) whole) { return (func)(all(whole), ## __VA_ARGS__); })(con)
#define rwhole(f,con,...)	([&](decltype((con)) rwhole) { return (func)(rall(rwhole), ##__VA_ARGS__); })(con)
#define cwhole(f,con,...)	([&](decltype((con)) cwhole) { return (func)(call(cwhole), ##__VA_ARGS__); })(con)
#define crwhole(f,con,...)	([&](decltype((con)) crwhole) { return (func)(crall(crwhole), ##__VA_ARGS__); })(con)
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define exist(s,e) ((s).find(e)!=(s).end())
#define sort(c) sort(all(c))
#define reverse(con) reverse(all(con))
#define reset(c) int _c=SZ(a);(c).clear();(c).resize(_c)
#define each(i,con) for(auto&& i :con)
#define each_ipt(con) each(itr,con)cin>>itr;
#define each_opt(x) each(itr,x)cout<<itr<<endl;
#define INF INT_MAX

// repetition
//----------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define repeat(i,n) FOR(i,0,n)

//clear memory
#define CLR(a) memset((a),0,sizeof(a))
#define nCLR(a) memset((a),-1,sizeof(a))

//debug
#ifdef DEBUG
#define dump(x) cerr<<#x<<"="<<(x)<<endl;
#define dump_pair(x) cerr<<#x<<"=["<<(x).first<<", "<<(x).second<<" ]"<<endl;
#define dump_tuple3(x) cerr<<#x<<"=["<<get<0>((x))<<", "<<get<1>((x))<<", "<<get<2>((x))<<" ]"<<endl;
#define debug(x) cerr<<#x<<"="<<(x)<<"(L"<<__LINE__<<")"<<""<<__FILE__<<endl;
template <typename T>
void dump_contents(const T& v, const string& msg)
{
	cerr << "### " << msg << " ###\n";
	for (const auto& x : v) {
		cerr << x << " ";
	}
	cerr << endl;
}
#else
#define dump(x)
#define dump_pair(x)
#define dump_tuple(x)
#define debug(x)
template <typename T>
void dump_contents(const T& v, const string& msg)
{
}

#endif
#ifdef STAY
#define stay cout<<"Push any key and Enter..."; scanf_s("%*s");
#else
#define stay
#endif

//main func
#define Main							\
	signed main(){						\
	cin.tie(0);							\
	ios_base::sync_with_stdio(0);		\
	cout << fixed << setprecision(12);	
#define Fin								\
	stay								\
	return 0;							\
}										
#endif


Main
int N;cin >> N;
int X;cin >> X;
vi x(N);
each(i, x) {
	cin >> i;
	i = abs(i - X);
}
sort(x);
int d = x[0];

BEGIN:;
each(i, x) {
	if (int(float(i) / d) != i / d) { --d;goto BEGIN; }
}
cout << d << endl;
Fin

Compiler output:
a.cc: In function 'int main()':
a.cc:179:49: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
  179 | #define stay cout<<"Push any key and Enter..."; scanf_s("%*s");
      |                                                 ^~~~~~~
a.cc:191:9: note: in expansion of macro 'stay'
  191 |         stay                                                            \
      |         ^~~~
a.cc:213:1: note: in expansion of macro 'Fin'
  213 | Fin
      | ^~~