unittest
{
	assert( [ "3 3", "1 7 11" ].parse.expand.solve == 2 );
	assert( [ "3 81", "33 105 57" ].parse.expand.solve == 24 );
	assert( [ "1 1", "1000000000" ].parse.expand.solve == 999999999 );
	
	assert( [ "3 10", "4 14 22" ].parse.expand.solve == 2 );		// 最大公約数が必要なケース
}



import std.algorithm;
import std.conv;
import std.functional;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nx = input.front.split.to!( long[] );
	input.popFront;
	auto xs = input.front.split.to!( long[] );
	return tuple( nx[ 0 ], nx[ 1 ], xs );
}

auto solve( long n, long x, long[] xs )
{
	xs ~= x;
	xs.sort();
	
	// 都市間の距離を計算
	auto ds = new long[ xs.length - 1 ];
	foreach( i, ref d; ds )
	{
		d = xs[ i + 1 ] - xs[ i ];
	}
	auto ds_u = ds.sort().uniq;
	
	// 都市間の距離の最大公約数を計算
	auto dg = ds[ 0 ];
	foreach( d; ds[ 1 .. $ ] )
	{
		dg = memoize!gcd( dg, d );
	}
	
	return dg;
}

auto gcd( long a, long b )
{
	while( a != 0 )
	{
		auto r = b % a;
		b = a;
		a = r;
	}
	
	return b;
}
