Hide and Seek 6

Interview

Time limit1sMemory limit512 MB

Summary
Given Subin's position S and the positions of N siblings, find the largest step size D such that repeated moves of +D or -D from S can reach every sibling.
Level

Medium4 of 10

Topics
Math, Number theory, Greedy, Implementation
Solved
No attempts yet

Problem

Subin is playing hide and seek with N younger siblings. Subin is currently at point S, and the siblings are at A1, A2, ..., AN.

Subin can move by walking. When Subin is at position X, walking moves her to X+D or X-D after 1 second. If Subin's position equals the position of a sibling, she has found that sibling.

She wants to choose the value of D so that she can find all the siblings. Find the maximum possible value of D.

Input

The first line gives N (1 ≤ N ≤ 105) and S (1 ≤ S ≤ 109). The second line gives the positions of the siblings Ai (1 ≤ Ai ≤ 109). All sibling positions are distinct and none equals Subin's position.

Output

Print the maximum possible value of D.

Examples3

  1. Example 1

    Input
    3 3
    1 7 11
    
    Expected output
    2
    
  2. Example 2

    Input
    3 81
    33 105 57
    
    Expected output
    24
    
  3. Example 3

    Input
    1 1
    1000000000
    
    Expected output
    999999999