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 (Python):

from math import gcd
from functools import reduce


def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    _max = max(A)
    g = reduce(gcd, A)

    if K <= _max and K % g == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")


if __name__ == "__main__":
    resolve()

Solution (Python):
import numpy as np
from math import gcd
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k in a:
    print("POSSIBLE")
    exit()
x=np.gcd.reduce(a)
if x==1:
    print("POSSIBLE")
else:
    if k<max(a) and k%x==0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Solution (Python):
import math
n,k = map(int, input().split())
a = list(map(int, input().split()))

g = a[0]
for i in range(n):
  g = math.gcd(g,a[i])

if k%g == 0 and k <= max(a):
  print ('POSSIBLE')
else:
  print ('IMPOSSIBLE')

Solution (Python):
N,K,*A=map(int,open(0).read().split())
from math import*
c=A[0]
for a in A:
    c=gcd(c,a)
print('IM'*(K%c>0 or K>max(A))+'POSSIBLE')

Solution (Python):
from math import gcd
n, k = map(int, input().split())
a = list(set(map(int, input().split())))
a.sort(); b = a[0]
for i in range(1, len(a)): b = gcd(b, a[i])
if len(a) == 1:
    print("POSSIBLE") if k == a[0] else print("IMPOSSIBLE")
else:
    print("POSSIBLE") if k <= a[-1] and k%b == 0 else print("IMPOSSIBLE")

Solution (Python):
from fractions import gcd
n,k=map(int,input().split())
*a,=map(int,input().split())

g=a[0]
for i in range(1,n):
    g=gcd(g,a[i])

if k in a or (k%g==0 and k<=max(a)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
from math import gcd
n, k = map(int,input().split())
a = list(map(int,input().split()))

from fractions import gcd
from functools import reduce

g = reduce(gcd, a)

if max(a) >= k and k%g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
from math import gcd
n, k = map(int,input().split())
a = list(map(int,input().split()))
g = a[0]

for i in range(n-1):
    g = gcd(g, a[i+1])
    
if max(a) >= k and k%g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
import math

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)

if K > A[-1]:
    print('IMPOSSIBLE')
    exit()

keep = A[0]
for i in range(1, N):
    keep = math.gcd(keep, A[i])
if K % keep == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
n,k=map(int,input().split())
A=list(map(int,input().split()))
yes="POSSIBLE" ; no="IMPOSSIBLE"
import numpy as np
q= np.gcd.reduce(A)
if k%q==0 and max(A)>=k:
    print(yes)
else:
    print(no)

Solution (Python):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

N,K=mint()
A=lint()
judge(K<=max(A) and K%lgcd(A)==0,['POSSIBLE','IMPOSSIBLE'])

Solution (Python):
import math
from functools import reduce
N, K = map(int, input().split())
A = list(map(int, input().split()))

def gcd_list(numbers):
  return reduce(math.gcd, numbers)

gcd = gcd_list(A)
if (K%gcd==0) and (K<=max(A)):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Solution (Python):
N, K =map(int, input().split())
A=list(map(int, input().split()))

def gcd(a, b):
	while b:
		a, b = b, a%b
	return a

g=0
max_a=0
for a in A:
	g=gcd(g, a)
	max_a=max(max_a, a)

if K%g==0 and K<=max_a:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Solution (Python):
import sys



def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]




def gcd(x: int, y: int) -> int:
    if x < y:
        x, y = y, x
    while y > 0:
        r = x % y
        x, y = y, r
    return x


def main():
    n, k = input_int_list()
    A = input_int_list()
    A_max = max(A)
    
    if k > A_max:
        print("IMPOSSIBLE")
        return

    A_gcd = A[0]
    for a in A:
        A_gcd = gcd(A_gcd, a)

    if k % A_gcd == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

    return


if __name__ == "__main__":
    main()

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
def input(): return sys.stdin.readline()[:-1] 


import string

from bisect import bisect_left, bisect_right
from functools import lru_cache, reduce
MOD = int(1e9)+7
INF = float('inf')


def solve():
    
    n, k = [int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    g = reduce(gcd, a)

    m = max(a)
    if k <= m and k % g == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

t = 1

for case in range(1,t+1):
    ans = solve()


"""
1
4
-1 1 1 -1

"""

Solution (Python):
from math import gcd
n, k = map(int, input().split())
a = list(map(int, input().split()))
if max(a) < k:
    print("IMPOSSIBLE")
    exit()
if k in a:
    print("POSSIBLE")
    exit()
a_gcd = a[0]
for i in range(1, n):
    a_gcd = gcd(a_gcd, a[i])

if k % a_gcd == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b)

h = a[0]
gcda = a[0]

for i in range(1, n):
    if a[i] > h:
        h = a[i]

    gcda = gcd(gcda, a[i])

if k%gcda == 0 and k <= h:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
from math import gcd
n,k = map(int,input().split())
A = list(map(int,input().split()))
g = A[0]
m = max(A)
for x in A:
    g = gcd(g,x)
print("POSSIBLE" if k%g == 0 and m >= k else "IMPOSSIBLE")

Solution (Python):
N,K=list(map(int,input().split()))
l=list(map(int,input().split()))
import math
if N==1:
   if l[0]==K:
      print("POSSIBLE")
      exit()
   else:
      print("IMPOSSIBLE")
      exit()
A=math.gcd(l[0],l[1])
if K<=max(l):
   for i in range(max(0,N-2)):
      A=math.gcd(A,l[i+2])
   if K%A==0:
      print("POSSIBLE")
   else:
      print("IMPOSSIBLE")
else:
   print("IMPOSSIBLE")

Solution (Python):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("POSSIBLE") if fl else print("IMPOSSIBLE")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil
gcd = math.gcd
n,k = ma()
A = lma()
mx = max(A)
tmp = A[0]
for a in A:
    tmp = gcd(a,tmp)
f=True

if mx<k:
    f=False
    yn(f)
    exit()
if tmp == 1:
    pass
else:
    if k%tmp==0:
        pass
    else:
        f=False
yn(f)

Solution (Python):
def resolve():
    '''
    code here
    '''
    import math
    N, K = [int(item) for item in input().split()]
    As = [int(item) for item in input().split()]

    gcd = As[0]
    for item in As[1:]:
        gcd = math.gcd(gcd, item)

        
    res = 'IMPOSSIBLE'
    max_A = max(As)
    if max_A > K:
        if K % gcd == 0:
            res = 'POSSIBLE'
    elif K in set(As):
        res = 'POSSIBLE'
    
    print(res)


if __name__ == "__main__":
    resolve()

Solution (Python):
from math import gcd

N,K=map(int,input().split())
A=list(map(int,input().split()))

ans=["POSSIBLE","IMPOSSIBLE"]

if max(A)<K:
    print(ans[1])
else:
    g=A[-1]
    for i in range(N-1):
        g=gcd(g,A[i])
    if K%g==0:
        print(ans[0])
    else:
        print(ans[1])

Solution (Python):
from math import gcd
from functools import reduce
n,k=map(int,input().split())
a=list((map(int,input().split())))
b=reduce(gcd,a)
print(['IMPOSSIBLE','POSSIBLE'][k%b==0 and k<=max(a)])

Solution (Python):
import sys, bisect, math

N, K = map(int, input().split())
A = list(map(int, sys.stdin.readline().rsplit()))

A.sort()
if bisect.bisect_left(A, K) == N:
    print("IMPOSSIBLE")
    exit()

a = A[0]
for aa in A[1:]:
    a = math.gcd(a, aa)

if K % a != 0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

Solution (Python):
import sys, math
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N, K = mi()
    A = list(mi())

    
    g = A[0]
    for i in range(N):
        g = math.gcd(A[i], g)

    
    m = max(A)
    
    if K%g==0 and m >= K:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')






if __name__ == '__main__':
    main()

Solution (Python):
from math import gcd
from functools import reduce

m,k = map(int,input().split())
L = list(map(int,input().split()))

v = reduce(gcd,L)
maxL = max(L)

if k > maxL:
    print("IMPOSSIBLE")
    exit()
if k in L:
    print("POSSIBLE")
    exit()
    
if (maxL - k)%v == 0:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")

Solution (Python):

import math
from functools import reduce

N, K = map(int, input().split())
A = list(map(int, input().split()))


def gcd(*numbers):
    return reduce(math.gcd, numbers)



gc = gcd(*A)
max_A = max(A)

if (K % gc == 0 and K <= max_A):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
lis=LI()
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
lis.sort()
x=lis[0]
for i in range(n-1):
    x=gcd(x,lis[i+1])
if lis[-1]-k>=0 and (lis[-1]-k)%x==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
from sys import exit
from math import gcd

def segfunc(x, y):
    '''
    問題に応じて返り値を設定
    '''
    return gcd(x, y)


def init(a):
    '''
    配列aで初期化
    '''
    for i in range(n):
        seg[i+num-1] = a[i]    
    for i in range(num-2, -1, -1) :
        seg[i] = segfunc(seg[2*i+1], seg[2*i+2])


def query(p, q):
    '''
    [p, q)についてsegfuncを適用したものを返す
    '''
    if q <= p:
        return ide_ele
    
    p += num - 1
    q += num - 2
    res = ide_ele

    while q - p > 1:
        if p & 1 == 0:
            res = segfunc(res, seg[p])
        if q & 1 == 1:
            res = segfunc(res, seg[q])
            q -= 1
        p = p // 2
        q = (q - 1) // 2
    
    if p == q:
        res = segfunc(res, seg[p])
    else:
        res = segfunc(res, segfunc(seg[p], seg[q]))
    
    return res


n, k = map(int, input().split())
a = list(map(int, input().split()))

if k > max(a):
    print('IMPOSSIBLE')
    exit()

num = (2 ** len(bin(n - 1)) - 2)
ide_ele = 0
seg = [ide_ele] * 2 * num

init(a)

if k % query(0, n) == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):

import sys

sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read


sys.setrecursionlimit(10**7)
import math

import bisect
import numpy as np




INF = 1 << 50


def run():
    N, K, *A = map(int, read().split())
    A_lists = [A]
    while True:
        generated_A = []
        B = A_lists[-1]
        for i in range(0, len(B), 2):
            if i+1 < len(B):
                val = math.gcd(B[i], B[i+1])
                generated_A.append(val)
            else:
                generated_A.append(B[i])
        A_lists.append(generated_A)
        if len(generated_A) == 1:
            break

    gcd = A_lists[-1][0]
    
    amax = max(A)
    if not K % gcd and K <= amax:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')



if __name__ == "__main__":
    run()

Solution (Python):
import sys
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, K = map(int, readline().split())
    A = list(map(int, readline().split()))

    if K > max(A):
        print("IMPOSSIBLE")
        exit()

    x = A[0]

    for i in range(1, N):
        x = math.gcd(A[i], x)

    if K % x == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")


if __name__ == '__main__':
    main()

Solution (Python):
from math import gcd
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K > max(A):
    print("IMPOSSIBLE")
    exit()

x = A[0]

for i in range(1, N):
    x = gcd(A[i], x)

if K%x == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
from math import gcd


def lgcd(x: list):
    res = x[0]
    for i in range(1, len(x)):
        res = gcd(res, x[i])

    return res


n, k = map(int, input().split())
a = list(map(int, input().split()))

m = max(a)
g = lgcd(a)

print(["IMPOSSIBLE", "POSSIBLE"][int(k % g == 0 and k <= m)])

Solution (Python):






import math
from functools import reduce





N,K = map(int, input().split())
A = list(map(int, input().split()))





def gcd_list(numbers):
    return reduce(math.gcd, numbers)





g = gcd_list(A)
if K <= max(A) and K%g == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
import math
n,k = map(int,input().split())
l = list(map(int,input().split()))
if max(l) < k:
    print("IMPOSSIBLE")
    exit()

x = l[0]
for i in l:
    x = math.gcd(x,i)

if k%x:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

Solution (Python):
import math
n,k = map(int,input().split())
l = list(map(int,input().split()))
if max(l) < k:
    print("IMPOSSIBLE")
    exit()

x = l[0]
for i in l:
    x = math.gcd(x,i)

if x == 1:
    print("POSSIBLE")
else:
    for i in l:
        if (k-i)%x == 0:
            print("POSSIBLE")
            exit()
    print("IMPOSSIBLE")

Solution (Python):
import math
n,k = map(int,input().split())
l = sorted(list(map(int,input().split())))
if l[-1] < k:
    print("IMPOSSIBLE")
    exit()
if k in l:
    print("POSSIBLE")
    exit()


x = l[0]
for i in l[1:]:
    x = math.gcd(x,i)

if x == 1:
    print("POSSIBLE")
else:
    for i in l:
        if (k-i)%x == 0:
            print("POSSIBLE")
            exit()
    print("IMPOSSIBLE")

Solution (Python):
import math
import functools
n, k = map(int, input().split())
a = list(map(int, input().split()))
a_max = max(a)
G = functools.reduce(math.gcd, a)
ok = True
if k > a_max:
    ok = False
else:
    if k%G == 0:
        pass
    else:
        ok = False

if ok:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):

from functools import reduce
from math import gcd

n, k, *a = map(int, open(0).read().split())
g = reduce(gcd, a)
if k <= max(a) and k%g <1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
import sys
from math import gcd

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    g = A[0]
    for a in A[1:]:
        g = gcd(g, a)

    if max(A) >= K and K % g == 0:
        ans = "POSSIBLE"
    else:
        ans = "IMPOSSIBLE"

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
from math import gcd

n,k = map(int, input().split())
al = list(map(int, input().split()))
a_gcd = al[0]
for a in al[1:]:
    a_gcd = gcd(a_gcd,a)

if k%a_gcd == 0 and k <= max(al):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))
if k > max(a):
    print("IMPOSSIBLE")
else:
    gcd = 0
    for i in range(n):
        gcd = math.gcd(gcd, a[i])
    if k % gcd == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Solution (Python):
from math import gcd

N,K=map(int,input().split())
A=list(map(int,input().split()))

G=A[0]
for a in A:
    G=gcd(G,a)

F=False
for a in A:
    if a>=K and (K-a)%G==0:
        F=True

if F:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
import sys
import math
import copy
import heapq
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter



input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD
def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD

def fact_and_inv(SIZE):
    inv = [0] * SIZE  
    fac = [0] * SIZE  
    finv = [0] * SIZE  
    inv[1] = 1
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    for i in range(2, SIZE):
        inv[i] = MOD - (MOD // i) * inv[MOD % i] % MOD
        fac[i] = fac[i - 1] * i % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    return fac, finv

def renritsu(A, Y):
    
    
    
    A = np.matrix(A)
    Y = np.matrix(Y)
    Y = np.reshape(Y, (-1, 1))
    X = np.linalg.solve(A, Y)

    
    return X.flatten().tolist()[0]

class TwoDimGrid:
    
    def __init__(self, h, w, wall="
        self.h = h
        self.w = w
        self.size = (h+2) * (w+2)
        self.wall = wall
        self.get_grid()
        

    def get_grid(self):
        grid = [self.wall * (self.w + 2)]
        for i in range(self.h):
            grid.append(self.wall + getS() + self.wall)

        grid.append(self.wall * (self.w + 2))
        self.grid = grid
    def init_cost(self):
        self.cost = [INF] * self.size

    def pos(self, x, y):
        
        return y * (self.w + 2) + x
    def getgrid(self, x, y):
        return self.grid[y][x]
    def get(self, x, y):
        return self.cost[self.pos(x, y)]
    def set(self, x, y, v):
        self.cost[self.pos(x, y)] = v
        return
    def show(self):
        for i in range(self.h+2):
            print(self.cost[(self.w + 2) * i:(self.w + 2) * (i+1)])
    def showsome(self, tgt):
        for t in tgt:
            print(t)
        return
    def showsomejoin(self, tgt):
        for t in tgt:
            print("".join(t))
        return

    def search(self):
        grid = self.grid
        move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
        move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
        
        
        
        
        

def solve():
    n, k = getList()
    nums = getList()
    nums.sort(reverse=True)
    c = nums[0]
    if c < k:
        print("IMPOSSIBLE")
        return
    for num in nums[1:]:
        c = math.gcd(c, num)
    
    if k % c == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")



def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    
    solve()

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, K = LI()
    A = LI()

    
    
    gcd = A[0]
    for i in A:
        gcd = math.gcd(gcd, i)

    if K % gcd == 0 and K <= max(A):
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

if __name__ == '__main__':
    resolve()

Solution (Python):
def main():
    import sys
    input = lambda:sys.stdin.readline().strip()

    N,K = map(int,input().split())
    A = list(map(int,input().split()))

    from math import gcd

    flag = 0
    if K in A: flag = 1
    elif max(A)<K: flag = 0
    else:
        x = max(A)-K
        g = A.pop(0)
        for a in A:
            g = gcd(g,a)

        if K%g==0:
            flag = 1
        
    print(['IMPOSSIBLE','POSSIBLE'][flag])
    


if __name__=='__main__':
    main()

Solution (Python):
from math import gcd

n, k = map(int, input().split())
a = list(map(int, input().split()))

num = 0
for ai in a:
    num = gcd(num, ai)
bool = (k % num) or (k > max(a))
print('IMPOSSIBLE' if bool else 'POSSIBLE')

Solution (Python):
import fractions
n,k = map(int,input().split())
a = list(map(int, input().split()))
if k > max(a):
  print("IMPOSSIBLE")
  exit()
ans = a[0]
for i in range(1, n):
    ans = fractions.gcd(ans, a[i])
if k%ans == 0:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Solution (Python):
import sys,math,collections,itertools
input = sys.stdin.readline

N,K=list(map(int,input().split()))
A=list(map(int,input().split()))
cd = A[0]
for a in A:
    cd = math.gcd(cd,a)
if K<=max(A) and K%cd == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, k = MAP()
a = LIST()

if n == 1:
    if a[0] == k:
        print("POSSIBLE")
        exit()
else:
    m = gcd(a[0], a[1])
    for x in a:
        m = gcd(m, x)
    for x in a:
        if x - k >= 0 and ( x - k ) % m == 0:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

Solution (Python):
import math
import functools

n,k = map(int, input().split())
a = list(map(int, input().split()))
g = functools.reduce(math.gcd, a)
if k % g == 0 and k <= max(a):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, K = read_ints()
    A = read_ints()
    if K > max(A):
        return 'IMPOSSIBLE'
    gcd = A[0]
    for i in range(1, N):
        gcd = math.gcd(gcd, A[i])
    if K%gcd != 0:
        return 'IMPOSSIBLE'
    return 'POSSIBLE'


if __name__ == '__main__':
    print(solve())

Solution (Python):
from fractions import *
n,k=map(int,input().split())
a=list(map(int,input().split()))
g=a[0]
for i in range(1,n):
    g=gcd(g,a[i])
if k%g==0 and k<=max(a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
n, k, *a = map(int, open(0).read().split())
from functools import*
import math
print("IM" * (k % reduce(math.gcd, a) > 0 or k > max(a)) + "POSSIBLE")

Solution (Python):
import math
n,k,*a = map(int,open(0).read().split())
a = list(set(a))
if k in a:
  print("POSSIBLE")
elif k>max(a):
  print("IMPOSSIBLE")
else:
  b = max(a)-k
  c = a.pop()
  for i in a:
    c = math.gcd(c,i)
    if c == 1:
      break
  if b%c == 0:
    print("POSSIBLE")
  else:
    print("IMPOSSIBLE")

Solution (Python):
from functools import reduce

def gcd(a,b):
  while b:
    c = a%b
    a = b
    b = c    
  return a

n,k = map(int,input().split())
A = list(map(int,input().split()))

ans = 'IMPOSSIBLE'  

if max(A) < k:
  pass
else:  
  m = reduce(gcd,A)
  for i in range(n):
    if (k-A[i])%m == 0:
      ans = 'POSSIBLE'
      break
  
print(ans)

Solution (Python):
def gcd_(a, b):
    if a < b:  a, b = b, a
    if b == 0:  return a
    return gcd_(b, a % b)

def gcd(l):
    ans = l[0]
    for i in l:  ans = gcd_(ans, i)
    return ans

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

def solve():   
    if N == 1:  return A == K    
    g = gcd(A)
    m = max(A)
    return K <= m and K % g == 0

N, K = cin()
A = cin()
ret = solve()
if ret:  print("POSSIBLE")
else:  print("IMPOSSIBLE")

Solution (Python):
def gcd_(a, b):
    if a < b:  a, b = b, a
    if b == 0:  return a
    return gcd_(b, a % b)

def gcd_bl(A):

    left = [0 for _ in range(N + 1)]
    right = [0 for _ in range(N + 1)]
    ans = [0 for _ in range(N)]

    left[1] = A[0]
    for i in range(1, N):  left[i + 1] = gcd_(left[i], A[i])
    right[-1 - 1] = A[-1]
    for i in range(1, N):  right[-1 - i - 1] = gcd_(right[-1 - i], A[-1 - i])
    for i in range(N):  ans[i] = gcd_(left[i], right[i + 1])
        
    return ans

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

def solve():   
    if N == 1:  return A == K    
    g = gcd_bl(A)
    for i in range(N):
        if A[i] == K:  return 1
        elif A[i] > K:
            temp = (K - A[i]) / g[i]
            if temp == int(temp):  return 1
    return 0

N, K = cin()
A = cin()
ret = solve()
if ret:  print("POSSIBLE")
else:  print("IMPOSSIBLE")

Solution (Python):
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    def gcd(x,y):
        r = x%y
        if r==0:
            return y
        return gcd(y, r)

    n, k =map(int, input().split())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    c = a[0]
    for i in range(n):
        c = gcd(a[i], c)
    if k%c == 0 and k <= a[0]:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
    

    
if __name__ == '__main__':
    main()

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from math import gcd
    from functools import reduce

    n, k = map(int, readline().split())
    a = list(map(int, readline().split()))
    a.sort()

    if a[-1] < k:
        return print("IMPOSSIBLE")

    if n == 1:
        if a[0] == k:
            return print("POSSIBLE")
        else:
            return print("IMPOSSIBLE")
    else:
        g = reduce(gcd, a)
        if k % g == 0:
            return print("POSSIBLE")
        else:
            return print("IMPOSSIBLE")


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, k = map(int, input().split())
a = list(map(int, input().split()))

import math

def cond():
    _max = max(a)
    if k > _max:
        return False
    _gcd = a[0]
    for i in a[1:]:
        _gcd = math.gcd(_gcd, i)
    return (k % _gcd) == 0

if cond():
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')