Buggy python submission (verdict: Time Limit Exceeded):
is_prime = [True] * (10**5)
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, len(is_prime)):
    if is_prime[i]:
        primes.append(i)
        for j in range(i*2, len(is_prime), i):
            is_prime[j] = False

def do_prime_fact(x, ps):
    res = {}
    for prime in primes:
        while x % prime == 0:
            x /= prime
            if not prime in res:
                res[prime] = 0
            res[prime] += 1
    if x > 1: # x is large prime
        res[x] = 1
    return res

def solve(x):
    y = do_prime_fact(x[1] - x[0], primes)
    ps = y.keys()
    ys = [do_prime_fact(x[i+1] - x[i], ps) for i in range(len(x)-1)]
    d = 1
    for k in ps:
        ok = True
        while ok:
            for y in ys:
                if (not k in y) or (y[k] == 0):
                    ok = False
                    break
            if ok:
                for y in ys:
                    y[k] -= 1
                d *= k
    return d

n, x0 = map(int, raw_input().split())
x = map(int, raw_input().split())
x = list(sorted(set([x0] + x)))
print(solve(x))

Fixed submission:
is_prime = [True] * (10**5)
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, len(is_prime)):
    if is_prime[i]:
        primes.append(i)
        for j in range(i*2, len(is_prime), i):
            is_prime[j] = False

def do_prime_fact(x, ps):
    res = {}
    for prime in ps:
        while x % prime == 0:
            x /= prime
            if not prime in res:
                res[prime] = 0
            res[prime] += 1
    if x > 1: # x is large prime
        res[x] = 1
    return res

def solve(x):
    y = do_prime_fact(x[1] - x[0], primes)
    ps = y.keys()
    ys = [do_prime_fact(x[i+1] - x[i], ps) for i in range(len(x)-1)]
    d = 1
    for k in ps:
        ok = True
        while ok:
            for y in ys:
                if (not k in y) or (y[k] == 0):
                    ok = False
                    break
            if ok:
                for y in ys:
                    y[k] -= 1
                d *= k
    return d

n, x0 = map(int, raw_input().split())
x = map(int, raw_input().split())
x = list(sorted(set([x0] + x)))
print(solve(x))

Buggy python submission (verdict: Time Limit Exceeded):
is_prime = [True] * (10**5)
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, len(is_prime)):
    if is_prime[i]:
        primes.append(i)
        for j in range(i*2, len(is_prime), i):
            is_prime[j] = False

def do_prime_fact(x):
    res = {}
    for prime in primes:
        if x == 1:
            return res
        while x % prime == 0:
            x /= prime
            if not prime in res:
                res[prime] = 0
            res[prime] += 1
    if x > 1: # x is large prime
        res[x] = 1
        primes.append(x)
    return res

def solve(x):
    ys = [do_prime_fact(x[i+1] - x[i]) for i in range(len(x)-1)]
    d = 1
    for k in ys[0].keys():
        ok = True
        while ok:
            for y in ys:
                if (not k in y) or (y[k] == 0):
                    ok = False
                    break
            if ok:
                for y in ys:
                    y[k] -= 1
                d *= k
    return d

n, x0 = map(int, raw_input().split())
x = map(int, raw_input().split())
x = list(sorted(set([x0] + x)))
print(solve(x))

Fixed submission:
is_prime = [True] * (10**5)
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, len(is_prime)):
    if is_prime[i]:
        primes.append(i)
        for j in range(i*2, len(is_prime), i):
            is_prime[j] = False

def do_prime_fact(x, ps):
    res = {}
    for prime in ps:
        while x % prime == 0:
            x /= prime
            if not prime in res:
                res[prime] = 0
            res[prime] += 1
    if x > 1: # x is large prime
        res[x] = 1
    return res

def solve(x):
    y = do_prime_fact(x[1] - x[0], primes)
    ps = y.keys()
    ys = [do_prime_fact(x[i+1] - x[i], ps) for i in range(len(x)-1)]
    d = 1
    for k in ps:
        ok = True
        while ok:
            for y in ys:
                if (not k in y) or (y[k] == 0):
                    ok = False
                    break
            if ok:
                for y in ys:
                    y[k] -= 1
                d *= k
    return d

n, x0 = map(int, raw_input().split())
x = map(int, raw_input().split())
x = list(sorted(set([x0] + x)))
print(solve(x))

Buggy python submission (verdict: Time Limit Exceeded):
is_prime = [True] * (10**5)
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, len(is_prime)):
    if is_prime[i]:
        primes.append(i)
        for j in range(i*2, len(is_prime), i):
            is_prime[j] = False

def do_prime_fact(x):
    res = {}
    for prime in primes:
        while x % prime == 0:
            x /= prime
            if not prime in res:
                res[prime] = 0
            res[prime] += 1
    if x > 1: # x is large prime
        res[x] = 1
    return res

def solve(x):
    ys = [do_prime_fact(x[i+1] - x[i]) for i in range(len(x)-1)]
    d = 1
    for k in ys[0].keys():
        ok = True
        while ok:
            for y in ys:
                if (not k in y) or (y[k] == 0):
                    ok = False
                    break
            if ok:
                for y in ys:
                    y[k] -= 1
                d *= k
    return d

n, x0 = map(int, raw_input().split())
x = map(int, raw_input().split())
x = list(sorted(set([x0] + x)))
print(solve(x))

Fixed submission:
is_prime = [True] * (10**5)
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, len(is_prime)):
    if is_prime[i]:
        primes.append(i)
        for j in range(i*2, len(is_prime), i):
            is_prime[j] = False

def do_prime_fact(x, ps):
    res = {}
    for prime in ps:
        while x % prime == 0:
            x /= prime
            if not prime in res:
                res[prime] = 0
            res[prime] += 1
    if x > 1: # x is large prime
        res[x] = 1
    return res

def solve(x):
    y = do_prime_fact(x[1] - x[0], primes)
    ps = y.keys()
    ys = [do_prime_fact(x[i+1] - x[i], ps) for i in range(len(x)-1)]
    d = 1
    for k in ps:
        ok = True
        while ok:
            for y in ys:
                if (not k in y) or (y[k] == 0):
                    ok = False
                    break
            if ok:
                for y in ys:
                    y[k] -= 1
                d *= k
    return d

n, x0 = map(int, raw_input().split())
x = map(int, raw_input().split())
x = list(sorted(set([x0] + x)))
print(solve(x))