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):
N, K = map(int, input().split())
inputs = [int(i) for i in input().split()]

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

tmp = inputs[0]
if K in inputs:
    print('POSSIBLE')
elif max(inputs) < K:
    print('IMPOSSIBLE')
else:
    if N == 1:
        if K == inputs[0]:
            print('POSSIBLE')
        else:
            print('IMPOSSIBLE')
    else:
        for i in range(1, N):
            tmp = gcd(tmp, inputs[i])
        if tmp == 1:
            print('POSSIBLE')
        else:
            if (max(inputs) - K) % tmp == 0:
                print('POSSIBLE')
            else:
                print('IMPOSSIBLE')

Solution (Python):
def euclid(x,y):
    a = max(x,y)
    b = min(x,y)
    
    r =  a % b
    while r != 0:
        a = b
        b = r
        r = a % b

    return b


N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]

if N == 1:
    if K == A[0]:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
else:
    
    M = max(A)
    G = euclid(A[0],A[1])
    for i in range(1,N):
        G = euclid(A[i],G)
    
    if K % G == 0 and K <= M:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
    
print(ans)

Solution (Python):
import fractions
N,K=map(int,raw_input().split())
A=map(int,raw_input().split())

for i in range(N):
	if i==0:
		pass
	elif i==1:
		g=fractions.gcd( A[0] , A[1] )
	else:
		g=fractions.gcd( g , A[i] )

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

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

a.sort()

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


if a[len(a)-1]<K:
    print("IMPOSSIBLE")
else:
    now = a[0]
    for i in range(len(a)-1):
        now = gcd(a[i+1], now)
    if K%now == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Solution (Python):
import functools
import fractions
N,K = map(int,input().split())
A = list(map(int,input().split()))
gcd = functools.reduce(fractions.gcd,A)
max_A = max(A)
if K % gcd == 0 and K <= max_A:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]


def gcd(x, y):
    if x < y:
        return gcd(y, x)
    elif y == 0:
        return x
    else:
        return gcd(y, x % y)


g = A[0]
for a in A:
    g = gcd(g, a)
if K <= max(A) and K % g == 0:
    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

b = 0
for a in A:
    b = gcd(a, b)

if K % b or K > max(A):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

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

S_possible = "POSSIBLE"
S_impossible = "IMPOSSIBLE"

b = 0

for a in A:
    b = gcd(a, b)

if K % b or K > max(A):
    print(S_impossible)
else:
    print(S_possible)

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

S_possible = "POSSIBLE"
S_impossible = "IMPOSSIBLE"

if N == 1:
    if K == A[0]:
        print(S_possible)
    else:
        print(S_impossible)
else:
    gcd_max = gcd(A[0], A[1])
    for i in range(N-1):
        gcd_current = gcd(A[i], A[i+1])
        if gcd_current < gcd_max:
            gcd_max = gcd_current
    if K % gcd_max == 0 and K <= max(A):
        print(S_possible)
    else:
        print(S_impossible)

Solution (Python):
from fractions import gcd

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

M = max(A)
while len(A)>1:
    a1 = A.pop()
    a2 = A.pop()
    A.append(gcd(a1, a2))
G = A[0]
if K%G==0 and K<=M:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):


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


n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)

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

if k % div == 0 and k <= a[-1]:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
def inpl(): return [int(i) for i in input().split()]

N, K = inpl()
A = inpl()
gcda = A[0]
for i in A:
    gcda = gcd(i, gcda)
if not K%gcda and max(A) >= K:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
import sys


def next_str() -> str:
    result = ""
    while True:
        tmp = sys.stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


def next_int() -> int:
    return int(next_str())


def gcd(x: int, y: int) -> int:
    while y != 0:
        x = x % y
        x, y = y, x
    return abs(x)


def main() -> None:
    n, k = [next_int() for _ in range(2)]
    g, m = [0 for _ in range(2)]

    for i in range(n):
        a = next_int()
        if i == 0:
            g = a
            m = a
        g = gcd(g, a)
        m = max(m, a)

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


if __name__ == '__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

if n==1:
  x=a[0]
else:
  x=gcd(a[0],a[1])
  for i in range(2,n):
    x=gcd(x,a[i])

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

Solution (Python):

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

def gcd(a,b):
    if a<b:
        a,b = b,a
    while b>0:
        a,b = b,a%b
    return a

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

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

Solution (Python):
def gcd(a,b):
    if b == 0:
        return abs(a)
    else:
        return gcd(b, a%b)

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

Im = 'IMPOSSIBLE'
Po = 'POSSIBLE'

if max(A) < K:
    print(Im)
else:
    for i in range(N):
        if i == 0:
            tmp = gcd(A[i], 0)
        else:
            tmp = gcd(A[i],tmp)
        if tmp == 1:
            break
    if K%tmp == 0:
        print(Po)
    else:
        print(Im)

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


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


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

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

Solution (Python):
n,k = map(int, input().split())
a = list(map(int, input().split()))
if k > max(a):
  print("IMPOSSIBLE")
  exit()
import fractions
from functools import reduce

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
i = gcd_list(a)
if k%i == 0:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

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

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

if len(L) == 1 :
    if L[0] == K :
        ans = "POSSIBLE"
    else :
        ans = "IMPOSSIBLE"

else :
    for i in range(N-1) :
        q = gcd(L[i],L[i+1])
        if i == 0 :
            p = gcd(L[i],L[i+1])
        if q < p :
            p = q

    if (K % p ==  0) and (K <= max(L)) :
        ans = "POSSIBLE"
    else :
        ans = "IMPOSSIBLE"
print(ans)

Solution (Python):
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

def GCD(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a%b
    return b

if K > max(A):
    print("IMPOSSIBLE")
else:
    gcdA = A[0]
    for i in range(1, N):
        gcdA = GCD(gcdA, A[i])
    print("POSSIBLE" if K % gcdA == 0 else "IMPOSSIBLE")

Solution (Python):
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if K > a[-1]:
    print('IMPOSSIBLE')
    exit()

def gcd(ga, b):
    if b == 0:
        return ga
    return gcd(b, ga%b)

gc = a[0]
for x in a:
    gc = gcd(gc, x)
if K % gc == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
import fractions
n,k=map(int, input().split())
a=sorted(map(int, input().split()))
f=a[0]
for i in a:f=fractions.gcd(i,f)
if k<=a[-1] and k%f==0:print('POSSIBLE')
else:print('IMPOSSIBLE')

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

a = sorted(list(set(a)))

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

n = len(a)

if n > 1:
    m = 10**9
    for i in range(n-1):
        if a[i] != a[i+1]:
            m = min(m, abs(a[i+1]-a[i]))
    for i in range(n):
        if abs(a[i]-k) % m == 0:
            print("POSSIBLE")
            exit()
else:
    if a[0] == k:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

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

a_list.sort()
max_num = a_list[-1]

if max_num < K:
    print("IMPOSSIBLE")
    exit()

exist = a_list.count(K)
if exist >= 1:
    print("POSSIBLE")
    exit()

from fractions import gcd
gcd_num = gcd(a_list[-1], a_list[-2])

for a in a_list:
    gcd_num= gcd(gcd_num, a)
if K%gcd_num == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

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

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

if max(As) < K:
    print('IMPOSSIBLE')
else:
    gcdA = As[0]
    for A in As[1:]:
        gcdA = gcd(gcdA, A)

    if K % gcdA == 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

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

n, k = map(int, input().split())
a = list(map(int, input().split()))
g = a[0]
for x in a:
    g = gcd(g, x)
print(("IMPOSSIBLE", "POSSIBLE")[k <= max(a) and k % g == 0])

Solution (Python):
n, k=map(int, raw_input().split())
a=map(int, raw_input().split())
def gcd(a, b):
	return gcd(b, a%b) if b else a
g=0
for i in range(n):
	g=gcd(g, a[i])
print "IMPOSSIBLE" if k%g!=0 or k>max(a) else "POSSIBLE"

Solution (Python):
from functools import reduce

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

def gcd_list(n):
    return reduce(gcd, n)

n, k = map(int, input().split())
a = list(map(int, input().split()))
if k % gcd_list(a) == 0 and k <= max(a):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

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

v = reduce(lambda a,b:gcd(a,b) , A)
if K % v == 0 and max(A) >= K :
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

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

Solution (Python):
from functools import reduce
def gcd(a,b):
  if a<b:a,b=b,a
  if a%b==0:return b
  return gcd(b,a%b)

read=lambda :map(int,input().split())
n,k=read()
*a,=read()

m=max(a)
o=reduce(gcd,a)
print("POSSIBLE" if k<=m and k%o==0 else "IMPOSSIBLE")

Solution (Python):
def GCD(a, b):
    if a < b:
        a, b = b, a
    while b > 0:
        a, b = b, a%b
    return a

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

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

G = A[0]
for i in range(1,N):
  G = GCD(G,A[i])
  
  
if K % G == 0:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Solution (Python):
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
n,k = map(int,input().split())
a = list(map(int,input().split()))
r = a[0]
for i in range(n):
    r = gcd(r,a[i])
if max(a) < k:
    print('IMPOSSIBLE')
elif max(a) == k:
    print('POSSIBLE')
else:
    if (max(a) - k ) % r == 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

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

Solution (Python):
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
import copy
Z = copy.deepcopy(A)

 
Z.sort()
i = 0

while True:
    if i >= len(Z):
        break
    if Z[i] == 0:
        del Z[i]
        i -= 1
    elif i > 0 and Z[i] == Z[i - 1]:
        del Z[i]
        i -= 1
    i += 1

ans = -1

import fractions
gcd = Z[0]
for i in range(1, len(Z)):
    gcd = fractions.gcd(gcd, Z[i])

if K % gcd == 0:
    ans = 1
    
if K > max(A):
    ans = -1
       
for i in A:
    if K == i:
        ans = 1
        break

if ans == -1:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

Solution (Python):
from functools import reduce

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

N, K, *A = map(int, open(0).read().split())

if K % reduce(gcd, A) or K > max(A):
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

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

Solution (Python):
f = lambda: map(int,input().split())


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


n,k = f()
a = list(f())
g = a[0]
for i in range(1,n):
    g = gcd(g,a[i])
print('POSSIBLE' if k<=max(a) and gcd(k,g)==g else 'IMPOSSIBLE')

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

def gcd(a, b):
    
    
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    else:
        c = a % b
        return gcd(b, c)
def gcd_list(l):
    
    d = l[0]
    for i in range(len(l) - 1):
        d = gcd(d, l[i + 1])
    return d

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

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


yes, no = "POSSIBLE", "IMPOSSIBLE"
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
if N == 1:
    print(yes if A[0] == K else no)
elif K > max(A):
    print(no)
else:
    GCD = gcd(A[0], A[1])
    for i in range(2, N):
        GCD = gcd(GCD, A[i])
    print(yes if K % GCD == 0 else no)

Solution (Python):
def gcd(t, u):
    if t < u:
        t, u = u, t
    while u > 0:

        t, u = u, t % u
    return t

def nl(): return list(map(int, input().split()))

n, k = nl()
a = nl()

g = a[0]
for x in a:

    g = gcd(x, g)

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

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

def main():
    n,k=map(int,input().split(" "))
    a=list(map(int,input().split(" ")))
    g=a[0]
    m=a[0]
    for e in a:
        g=gcd(g,e)
        if m<e: m=e
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Solution (Python):
a, b = map(int, input().split())
array = list(map(int, input().split()))
impossible = "IMPOSSIBLE"
possible = "POSSIBLE"

array = list(set(array))

if len(array) == 1:
    if b == array[0]:
        print(possible)
    else:
        print(impossible)
    exit(0)

array.sort()

btw = [v1 - v2 for v1, v2 in zip(array[1:], array[0:])]
n = sorted(btw)[0]

same = len(set(btw)) == 1 or all([v % n == 0 for v in btw])

if b in array:
    print(possible)
elif array[-1] < b:
    print(impossible)
elif same and (b - array[0]) % n == 0:
    print(possible)
else:
    print(impossible)

Solution (Python):
n,k = map(int,raw_input().split())

arr = map(int,raw_input().split())
if k > max(arr):
	print "IMPOSSIBLE"
	quit()

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

g = arr[0]

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

if k%g == 0 :
	print "POSSIBLE"

else :
	print "IMPOSSIBLE"

Solution (Python):
def findGCD(a:int, b:int) -> int:
    
    while 1:
        if a%b == 0:
            return b
        else:
            a = a%b
        
        if b%a == 0:
            return a
        else:
            b = b%a
            
from functools import reduce

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


gcd = reduce(findGCD, a)

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

Solution (Python):
def findGCD(a:int, b:int) -> int:
    
    if a <= 0:
        raise ValueError("aは0より大きくなければいけません。(a:{})".format(a))
    elif b <= 0:
        raise ValueError("bは0より大きくなければいけません。(b:{})".format(b))
    
    
    while 1:
        if a%b == 0:
            return b
        else:
            a = a%b
        
        if b%a == 0:
            return a
        else:
            b = b%a
            
from functools import reduce

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


gcd = reduce(findGCD, a)

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

Solution (Python):
import math

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
n,k = map(int,input().split())

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

b = a[0]

for i in a:
    b = gcd(b,i)

if k > max(a) or k%b != 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

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

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

from functools import reduce
g = reduce(gcd, a)

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

Solution (Python):
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

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

from functools import reduce

a = sorted(A)
d = reduce(gcd, a)

if (a[-1] >= K) and (a[-1] - K) % d == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):

 
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
def gcd(a, b):
    if a > b:
        a, b = b, a
    
    if b%a == 0:
        return a
    else:
        return gcd(b%a, a)
 
def gcd_many(l):
    
    
    
    
    
    
    if len(l) == 1:
        return l[0]
    g = l[0]
    for i in range(1,len(l)):
        g = gcd(g, l[i])
    return g
 
Amax = max(A)
g = gcd_many(A)
 
possible = "POSSIBLE"
impossible = "IMPOSSIBLE"
 
 
if K > Amax:
    print(impossible)
else:
    if K % g == 0:
        print(possible)
    else:
        print(impossible)

Solution (Python):
from fractions import gcd

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

if n == 1:
	if a[0] == k:
		print("POSSIBLE")
	else:
		print("IMPOSSIBLE")
else:
	if k in a:
		print("POSSIBLE")
	elif k > max(a):
		print("IMPOSSIBLE")
	else:
		g = gcd(a[0], a[1])
		for i in range(2, n):
			g = gcd(g, a[i])

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

Solution (Python):
from fractions import gcd
N,K=map(int,input().split())
A=[int(i) for i in input().split()]

def f(L):
    if N==1:
        return L[0]
    else:
        a = gcd(L[0],L[1])
        for i in range(2,N):
            a = gcd(a,L[i])
        return a

s=f(A)
if max(A)<K or K%s!=0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

Solution (Python):

import fractions

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

A = list(map(int,input().split()))
MAX = max(A)

if K in A:
    print("POSSIBLE")
elif K<=MAX:
    GCD = A[0]
    for a in A[1:]: GCD = fractions.gcd(GCD,a)
    if K%GCD==0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
def a_getting_difference(N, K, A):
    import fractions 
    gcd_a = A[0]
    max_a = max(A)
    for i in range(1, N):
        gcd_a = fractions.gcd(gcd_a, A[i])

    ans = 'POSSIBLE' if K <= max_a and K % gcd_a == 0 else 'IMPOSSIBLE'
    return ans

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(a_getting_difference(N, K, A))

Solution (Python):
import fractions
import sys

n, k = map(int, input().split())
array = [int(x) for x in input().split()]

if n == 1:
    print("POSSIBLE" if max(array) == k else "IMPOSSIBLE")
    sys.exit()

res = fractions.gcd(array[0], array[1])

for i in array[2:]:
    res = fractions.gcd(res, i)
print("POSSIBLE" if k%res==0 and max(array) >= k else "IMPOSSIBLE")

Solution (Python):


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

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

def gcd_many(l):
    
    
    
    
    
    
    if len(l) == 1:
        return l[0]
    g = l[0]
    for i in range(1,len(l)):
        g = gcd(g, l[i])
    return g

Amax = max(A)
g = gcd_many(A)

possible = "POSSIBLE"
impossible = "IMPOSSIBLE"


if K > Amax:
    print(impossible)
else:
    if K % g == 0:
        print(possible)
    else:
        print(impossible)

Solution (Python):
n,k=map(int,input().split())
t=list(map(int,input().split()))
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
ans=t[0]
for i in range(n):
    ans=gcd(ans,t[i])
if k%ans==0:
    if k<=max(t):
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Solution (Python):
def gcd(a0, b0):
    a, b = max(a0, b0), min(a0, b0)
    while b != 0:
        a = a % b
        a, b = b, a

    return a


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

    if n == 1:
        if k in a:
            print("POSSIBLE")
        else:
            print("IMPOSSIBLE")
    
    else:
        g = gcd(a[0], a[1])
        for i in range(2, len(a)):
            g = gcd(a[i], g)

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


if __name__ == '__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
ans=a[0]
for i in range(1,n):
    ans=gcd(ans,a[i])
if k%ans==0:
    if k<=max(a):
        print("POSSIBLE")
        exit()
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


if max(A) < K:
    print("IMPOSSIBLE")
    exit()
elif K in A:
    print("POSSIBLE")
    exit()

while len(A) > 1:
    A.append(gcd(A.pop(), A.pop()))

if K % A[0] == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
from functools import reduce

import platform
ver = platform.python_version_tuple()
if int(ver[1]) < 5:
    from fractions import gcd
else:
    from math import gcd

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

    gcd_ = reduce(gcd, A)
    if max(A) >= K and not K % gcd_:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

main()

Solution (Python):
tmp = list(map(int,input().split()))
n , m = tmp[0],tmp[1]
lis = list(map(int,input().split()))
import math
def gcd(a,b):
  if a % b:
    return(gcd(b,a%b))
  else:
    return(b)
  
from functools import reduce

def mygcd(*numbers):
     return reduce(gcd, numbers)

x = mygcd(*lis)
if m <= max(lis) and not (m % x):
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

Solution (Python):
from fractions import gcd
n, k = map(int,input().split())
balls = list(map(int,input().split()))
balls.sort()
p = max(balls)
if k in balls:
    print("POSSIBLE")
    exit()
elif  p < k:
    print("IMPOSSIBLE")
    exit()
for i in range(n-1):
    p = gcd(p, balls[i])
if k % p == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
from fractions import gcd

n,c= [int(i) for i in input().split()]
a=[int(i) for i in input().split()]
a.sort()
b=a[0]
for i in range(1,n):
  b=gcd(b,a[i])

if c > a[n-1]:
  print('IMPOSSIBLE')
else:
  print('POSSIBLE' if c % b==0 else "IMPOSSIBLE")

Solution (Python):
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
n,k=map(int,input().split())
t=list(map(int,input().split()))
m=max(t)
ans=t[0]
for i in t:
    ans=gcd(ans,i)
if k<=m and k%ans==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
n,k=map(int,input().split())
a=list(map(int,input().split()))
ma=max(a)
g=a[0]
for i in a:
  g=gcd(g,i)
if(k%g==0 and k<=ma):print("POSSIBLE")
else:print("IMPOSSIBLE")

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

N,K=map(int,input().split())
A=[int(x) for x in input().split()]

ans=max(A)
cnt=ans
for i in range(N):
  cnt=gcd(cnt,A[i])

if K%cnt==0 and K<=ans:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

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



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


while len(A) > 1:
    A.append(gcd(A.pop(), A.pop()))
if K % A[0] == 0 and any(map(lambda x: x >= K, B)):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):


import sys, math, copy




HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

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

def gcd_all(a):
    g = a[0]
    for y in a:
        g = gcd(g, y)
    return g

def main():
    n, k = map(int, input().split())
    ai = list(map(int, input().split()))
    assert len(ai) == n
    g = gcd_all(ai)
    m = max(ai)
    if m - k >= 0 and (m - k) % g == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Solution (Python):
n,k = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
a.sort()
for i in range(a[0],0,-1):
	if a[0]%i==0:
		if all(a[j]%i==0 for j in range(n)):
			num = i
			break
if k%num==0 and k<=a[-1]: 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 = A[0]
for A_i in A:
    G = gcd(A_i, G)

if K > max(A):
    print('IMPOSSIBLE')
elif K % G == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
import math
def gcd(a,b):
    c=max([a,b])
    d=min([a,b])
    if c%d==0:
        return d
    else:
        return gcd(d,c%d)
N,K=map(int, input().split())
A=[int(i) for i in input().split()]
if max(A)<K:
    print("IMPOSSIBLE")
else:
    G=A[0]
    for i in range(1,N):
        G=gcd(G,A[i])
    if K%G==0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

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

A = sorted(A)
if A[N-1] < K:
    print("IMPOSSIBLE")
    exit()

min_A = A[0]
for i in range(1,N):
    if A[i]-A[i-1] != 0:
        min_A = min(min_A,A[i]-A[i-1])

for j in range(N):
    if A[j]%min_A != 0:
        print("POSSIBLE")
        exit()
if K % min_A == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):


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

n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==1:
    if k==a[0]:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
    exit()
g=gcd(a[0],a[1])
mx=max(a)
for i in range(2,n):
    g=gcd(g,a[i])
if k%g==0 and k<=mx:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
N, K = map(int, input().split())
*A, = map(int, input().split())
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
g = A[0]
for i in range(1, N):
    g = gcd(g, A[i])

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

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


mod=functools.reduce(gcd,A)

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

Solution (Python):
import fractions
import functools
n, k = map(int, input().split())
a = list(map(int, input().split()))
g = functools.reduce(fractions.gcd, a)

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

Solution (Python):
import fractions


N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()
temp = A[0]
for a in A:
    temp = fractions.gcd(temp, a)
if temp == 1:
    if K <= max(A):
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
else:
    if K > max(A):
        print("IMPOSSIBLE")
    elif K % temp == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Solution (Python):
from fractions import gcd
N,K=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
ans=A[0]
for i in range(1,N):
        ans=gcd(ans,A[i])
if K%ans==0 and K<=max(A):
        print("POSSIBLE")
else:
        print("IMPOSSIBLE")

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

input1 = list(map(int,input("").split(" ")))
A = list(map(int,input("").split(" ")))
N = input1[0]
K = input1[1]

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

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