Problem:
Score : 300 points

Problem Statement

There is a box containing N balls. The i-th ball has the integer A_i written on it.
Snuke can perform the following operation any number of times:

Take out two balls from the box. Then, return them to the box along with a new ball, on which the absolute difference of the integers written on the two balls is written.

Determine whether it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written.

Constraints

1 \leq N \leq 10^5

1 \leq A_i \leq 10^9

1 \leq K \leq 10^9

All input values are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 ... A_N

Output

If it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written, print POSSIBLE; if it is not possible, print IMPOSSIBLE.

Sample Input 1

3 7
9 3 4

Sample Output 1

POSSIBLE

First, take out the two balls 9 and 4, and return them back along with a new ball, abs(9-4)=5.
Next, take out 3 and 5, and return them back along with abs(3-5)=2.
Finally, take out 9 and 2, and return them back along with abs(9-2)=7.
Now we have 7 in the box, and the answer is therefore POSSIBLE.

Sample Input 2

3 5
6 9 3

Sample Output 2

IMPOSSIBLE

No matter what we do, it is not possible to have 5 in the box. The answer is therefore IMPOSSIBLE.

Sample Input 3

4 11
11 3 7 15

Sample Output 3

POSSIBLE

The box already contains 11 before we do anything. The answer is therefore POSSIBLE.

Sample Input 4

5 12
10 2 8 6 4

Sample Output 4

IMPOSSIBLE

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Runtime.CompilerServices;
using ll=System.Int64;

public class Contest
{
	static void Swap1<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
	static void Swap2<T>(ref T a, ref T b) where T : IComparable { if (a.CompareTo(b)==1) Swap1(ref a, ref b); }  // b の方が小さければ交換
	static bool Chmin<T>(ref T a, T b) where T : IComparable { if (a.CompareTo(b)== 1) { a = b; return true; } return false; }  // b の方が小さければ a を更新
	static bool Chmax<T>(ref T a, T b) where T : IComparable { if (a.CompareTo(b)==-1) { a = b; return true; } return false; }  // b の方が大きければ a を更新
	static T[][] InitMat<T>(long len1, long len2, T val){ T[][] m = new T[len1][]; for (int i = 0; i < m.Length; i++) m[i] = Enumerable.Repeat(val, (int)len2).ToArray(); return m; }
	static T[][][] InitMat<T>(long len1, long len2, long len3, T val){ T[][][] m = new T[len1][][]; for (int i = 0; i < m.Length; i++) m[i] = InitMat(len2,len3,val); return m; }
	public const long MOD1 = 1000000007; // 10^9+7
	public const double EPS1 = 1e-8;

	public static void Main() {
		Solve_A();
 	}

	public static void Solve_A() {
		ll  n, k;
		MyIO.ReadMulti(out n, out k);
		ll[] a;
		MyIO.ReadArray(out a);

		ll max = a[0];
		ll gcd = a[0];
		for (int i = 1; i < n; i++)
		{
			Chmax(ref max, a[i]);
			gcd = Gcd(gcd,a[i]);
		}

		string ans = "IMPOSSIBLE";
		if((k<=max)&&(k%gcd==0)) ans = "POSSIBLE";

		MyIO.WriteMulti(ans);

	}
	public static void Solve_B() {
		ll  n;
		MyIO.ReadMulti(out n);
		VT<ll,ll>[] lrl;
		MyIO.ReadLines(n, out lrl);


		VT<ll,ll,ll>[] lri = new VT<ll, ll, ll>[n];
		for (int i = 0; i < n; i++)
		{
			lri[i] = new VT<ll, ll, ll>(lrl[i].Item1,lrl[i].Item2,i);
		}

		Array.Sort(lri,(x,y)=>(x.Item1.CompareTo(y.Item1)));

		VT<ll,ll>[] ll = new VT<ll, ll>[n+2];
		VT<ll,ll>[] rl = new VT<ll, ll>[n+2];
		ll[0]= new VT<ll, ll>(1,1000000000);
		rl[n+1]= new VT<ll, ll>(1,1000000000);

		long ans = 0;

/*
		for (int i = 1; i <= n; i++)
		{
			ll[i]= new VT<ll, ll>(Math.Max(lrl[i-1].Item1,ll[i-1].Item1),Math.Min(lrl[i-1].Item2,ll[i-1].Item2));
		}
		for (int i = (int)n; 0<i; i--)
		{
			rl[i]= new VT<ll, ll>(Math.Max(lrl[i-1].Item1,rl[i+1].Item1),Math.Min(lrl[i-1].Item2,rl[i+1].Item2));
		}

		for (int i = 1; i < n-1; i++)
		{
			ll v = ((ll[i].Item2>=ll[i].Item1)?(ll[i].Item2-ll[i].Item1+1):0) + ((rl[i+1].Item2>=rl[i+1].Item1)?(rl[i+1].Item2-rl[i+1].Item1+1):0);
			Chmax(ref ans, v);
		}
*/
		ll l2 = lri[n-1].Item1;
		ll r2 = lri[n-1].Item2;
		ll i2 = lri[n-1].Item3;
		ll i2a = lri[0].Item3;
		Array.Sort(lri,(x,y)=>(x.Item2.CompareTo(y.Item2)));		
		ll l1 = lri[0].Item1;
		ll r1 = lri[0].Item2;
		ll i1 = lri[0].Item3;
		if(i1==i2){
		 l1 = lri[1].Item1;
		 r1 = lri[1].Item2;
		 i1 = lri[1].Item3;
		}
		ll i1a = lri[n-1].Item3;


		if(i2a==i1a){
			for (int i = 0; i < n; i++)
			{
				if(lri[i].Item3==i1a) {
				l2 = lri[i].Item1;
				r2 = lri[i].Item2;
				}else{
				l1 = l1<lri[i].Item1?lri[i].Item1:l1;
				r1 = r1<lri[i].Item2?r1:lri[i].Item2;
				}
			}

		}else{
			for (int i = 0; i < n; i++)
			{
				ll tl1 = l1<lrl[i].Item1?lrl[i].Item1:l1;
				ll tl2 = l2<lrl[i].Item1?lrl[i].Item1:l2;
				ll tr1 = r1<lrl[i].Item2?r1:lrl[i].Item2;
				ll tr2 = r2<lrl[i].Item2?r2:lrl[i].Item2;
				ll d1 = Math.Max(r1-l1,-1)-Math.Max(tr1-tl1,-1);
				ll d2 = Math.Max(r2-l2,-1)-Math.Max(tr2-tl2,-1);
				if(d2<d1){
					l2 = tl2;
					r2 = tr2;
				}else{
					l1 = tl1;
					r1 = tr1;	
				}
			}


			}
			ans = Math.Max(r1-l1,-1)+Math.Max(r2-l2,-1)+2;
		MyIO.WriteMulti(ans);

	}
	public static void Solve_C() {
		ll  n, m;
		MyIO.ReadMulti(out n, out m);



		long ans = 0;

		MyIO.WriteMulti(ans);

	}
	public static void Solve_D() {
		ll  n, m;
		MyIO.ReadMulti(out n, out m);



		long ans = 0;

		MyIO.WriteMulti(ans);

	}
	public static void Solve_E() {
		ll  n, m;
		MyIO.ReadMulti(out n, out m);



		long ans = 0;

		MyIO.WriteMulti(ans);

	}
	public static void Solve_F() {
		ll  n, m;
		MyIO.ReadMulti(out n, out m);



		long ans = 0;

		MyIO.WriteMulti(ans);

	}



	public static long Gcd(long a, long b) {
	    var v = new[] { a, b };
	    while (v[1] != 0) v = new[] { v[1], v[0] % v[1] };
	    return v[0];
	}









}


















#region MyIO

public struct VT<T, U>
{
	public T Item1; public U Item2;
    public VT(T a, U b) { Item1 = a; Item2 = b; }
}
public struct VT<T, U, V>
{
	public T Item1; public U Item2; public V Item3;
    public VT(T a, U b, V c) { Item1 = a; Item2 = b; Item3 = c; }
}
public struct VT<T, U, V, W>
{
	public T Item1; public U Item2; public V Item3; public W Item4;
    public VT(T a, U b, V c, W d) { Item1 = a; Item2 = b; Item3 = c; Item4 = d; }
}

public class Printer : System.IO.StreamWriter
{
	public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
	public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
	public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
}
public static class MyIO
{
	private static char[] splitter = new char[] {' '};
	private static bool eq<T, U>() => typeof(T).Equals(typeof(U));
	private static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
	private static T cv<T>(string s) =>
		eq<T, int>()    ? ct<T, int>(int.Parse(s))
	  : eq<T, long>()   ? ct<T, long>(long.Parse(s))
	  : eq<T, double>() ? ct<T, double>(double.Parse(s, System.Globalization.CultureInfo.InvariantCulture))
	  : eq<T, char>()   ? ct<T, char>(s[0])
						: ct<T, string>(s);
			
	public static string[] ReadMulti<T>(out T a) {
		var ar = Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries); 
		a = cv<T>(ar[0]);
		return ar;
	}
	public static string[] ReadMulti<T, U>(out T a, out U b) {
		var ar = ReadMulti<T>(out a); 
        b = cv<U>(ar[1]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V>(out T a, out U b, out V c) {
		var ar = ReadMulti<T, U>(out a, out b); 
        c = cv<V>(ar[2]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W>(out T a, out U b, out V c, out W d) {
		var ar = ReadMulti<T, U, V>(out a, out b, out c); 
        d = cv<W>(ar[3]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) {
		var ar = ReadMulti<T, U, V, W>(out a, out b, out c, out d); 
        e = cv<X>(ar[4]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) {
		var ar = ReadMulti<T, U, V, W, X>(out a, out b, out c, out d, out e); 
        f = cv<Y>(ar[5]);
		return ar;
	}
	public static string[] ReadArray<T>(out T[] a) {		
		var ar = Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
		a = ar.Select(cv<T>).ToArray();
		return ar;
	}		
	public static string[][] ReadLines<T>(long n, out T[] a) {
		a = new T[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) arr[i] = ReadMulti(out a[i]);
		return arr;
	}
	public static string[][] ReadLines<T, U>(long n, out VT<T, U>[] a) {
		a = new VT<T, U>[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) {
			T o; U p;
			arr[i] = ReadMulti(out o, out p);
			a[i] = new VT<T, U>(o, p);
		}
		return arr;
	}
	public static string[][] ReadLines<T, U, V>(long n, out VT<T, U, V>[] a) {
		a = new VT<T, U, V>[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) {
			T o; U p; V q;
			arr[i] = ReadMulti(out o, out p, out q);
			a[i] = new VT<T, U, V>(o, p, q);
		}
		return arr;
	}
	public static string[][] ReadLines<T, U, V, W>(long n, out VT<T, U, V, W>[] a) {
		a = new VT<T, U, V, W>[n];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) {
			T o; U p; V q; W r;
			arr[i] = ReadMulti(out o, out p, out q, out r);
			a[i] = new VT<T, U, V, W>(o, p, q, r);
		}
		return arr;
	}
	public static string[][] ReadMatrix<T>(long n, out T[][] a) {
		a = new T[n][];
		string[][] arr = new string[n][];
		for(int i=0; i<n; i++) arr[i] = ReadArray(out a[i]);
		return arr;
	}

	private static void wwp(Action act){
		var sw = new Printer(Console.OpenStandardOutput()){AutoFlush = false};
		Console.SetOut(sw);
		act();
		Console.Out.Flush();
		sw.AutoFlush = true;
		Console.SetOut(sw);
	}
	private static string wfm(Type t) =>t.Equals(typeof(double)) ? "{0:F10}" : "{0}";
	public static void WriteMulti(params object[] a) {
		wwp(()=>{
			for(int i=0;i<a.Length;i++) {
				string fs = wfm(a[i].GetType()) + ((i<a.Length-1) ? " " : Environment.NewLine);
				Console.Write(fs, a[i]);
			}
		});
	}
	public static void WriteArray<T>(T[] a) {
		wwp(()=>{
			string fs = wfm(typeof(T));
			string fs1 = fs + " ";
			string fs2 = fs + Environment.NewLine;
			for(int i=0;i<a.Length;i++) Console.Write( ((i<a.Length-1) ? fs1 : fs2), a[i]);
		});
	}
	public static void WriteLines<T>(T[] a) {
		wwp(()=>{
			string fs = wfm(typeof(T)) + Environment.NewLine;
			foreach(T x in a) Console.Write(fs, x);
		});
	}


}

#endregion