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):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
from functools import reduce
mod = 10 ** 9 + 7
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





n,k=mii()
arr=limii()

def gcd1(numbers):
    return reduce(gcd,numbers)

p=gcd1(arr)

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

Solution (Python):

from fractions import gcd
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
a = 0
for i in range(N):
    a = gcd(a, A[i])
if K % a == 0 and K <= A[-1]:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

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

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

Solution (Python):
import fractions
from functools import reduce

def gcd(l):
    return reduce(fractions.gcd, l)
    
n, k = map(int, input().split())
a = list(map(int, input().split()))

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

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


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

g = 0
for aa in a:
    g = gcd(g, aa)

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

Solution (Python):
from fractions import gcd

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

ans = 'IMPOSSIBLE'

if max(A) < M:
    print(ans)
elif M in A:
    ans = 'POSSIBLE'
    print(ans)
else:
    g = A[-1]
    for a in A:
        g = gcd(g, a)
    if M % g == 0:
        ans = 'POSSIBLE'
        print(ans)
    else:
        print(ans)

Solution (Python):
n,k,*a=map(int,open(0).read().split())

from fractions import gcd


G=a[0]
for i in a:
    G=gcd(G,i)
    
A=max(a)
if k>A:
    print("IMPOSSIBLE")
    exit()
    
while A>0:
    if k==A:
        print("POSSIBLE")
        exit()
    A-=G
print("IMPOSSIBLE")

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    
    N, K = Scanner.map_int()
    A = Scanner.map_int()
    g = A[0]
    for i in range(1, N):
        g = Math.gcd(g, A[i])
    if K % g == 0 and max(A) >= K:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
    return


if __name__ == "__main__":
    main()

Solution (Python):
from functools import reduce
from fractions import gcd
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k%reduce(gcd,a)==0 and max(a)>=k:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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


N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()

max_val = max(A)
if max_val < K:
    print("IMPOSSIBLE")
    exit()

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

ans = max_val
while K <= ans:
    if K == ans:
        print("POSSIBLE")
        exit()
    else:
        ans -= gcd_val
print("IMPOSSIBLE")

Solution (Python):
from sys import stdin
import fractions
n,k = [int(x) for x in stdin.readline().rstrip().split()]
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
if k > li[-1]:
    print("IMPOSSIBLE")
    exit()
gcd = li[0] 
for i in range(n-1):
    gcd = fractions.gcd(gcd,li[i+1])
if k%gcd != 0:
    print("IMPOSSIBLE")
    exit()
print("POSSIBLE")

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


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

tmp = al[0]
for a in al:
    tmp = gcd(a, tmp)

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

Solution (Python):
import sys
from fractions import gcd

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

A.sort()
if A[-1] < K:
    print("IMPOSSIBLE")
    sys.exit()
    
s = A[0]
for i in A:
    s = gcd(s, i)

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

Solution (Python):
from functools import reduce
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
def gcdlist(A):
    if len(A) == 1:
        return A[0]
    else:
        return reduce(gcd,A)

N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = gcdlist(A)
if (K in A or (K%ans == 0)) and K <= max(A):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

if k > lst[-1]:
    print('IMPOSSIBLE')
elif k in lst:
    print('POSSIBLE')
else:
    dif = 10**5
    a = lst[0]
    b = lst[1]
    
    while True:
        dif = b-a
        if dif in lst or dif <= 0:
            break
        else:
            lst.append(dif)
            b = max(dif, a)
            a = min(dif, a)
    
    mn = min(lst)
    for l in lst:
        if l>k and (l-k)%mn==0:
            print('POSSIBLE')
            exit()
    print('IMPOSSIBLE')

Solution (Python):
def gcd(a: int, b: int) -> int:
    """a, bの最大公約数(greatest common divisor:GCD)を求める
    計算量: O(log(min(a, b)))
    """
    if b == 0:
        return a
    return gcd(b, a%b)


def lcm(a: int, b: int) -> int:
    """a, bの最小公倍数(least common multiple:LCM)を求める
    計算量: O(log(min(a, b)))"""
    return (a * b) // gcd(a, b)


def multi_gcd(array: list) -> int:
    """arrayのGCDを求める
    計算量: O(Nlog)
    """
    n = len(array)
    ans = array[0]
    for i in range(1, n):
        ans = gcd(ans, array[i])
    return ans


def multi_lcm(array: list) -> int:
    """arrayのLCMを求める"""
    ans = array[0]
    for i in range(1, len(array)):
        ans = (ans * array[i]) // gcd(ans, array[i])
    return ans

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

gcd_ = multi_gcd(a)
max_a = max(a)
if max_a < k:
    print("IMPOSSIBLE")
elif k % gcd_ == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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



ma = 0
d = A[0]
found = False
for a in A:
    ma = max(ma, a)
    d = gcd(d, a)
    if a == K:
        found = True
if found:
    print('POSSIBLE')
    exit()

if ma < K:
    print('IMPOSSIBLE')
    exit()
if K % d == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

import fractions as math

def gcdlist(l):
    a = l[0]
    for i in range(len(l)):
        a = math.gcd(a,l[i])
        if a == 1:
            break
    return a


p = gcdlist(lst1)

if max(lst1) < k:
    print("IMPOSSIBLE")

elif k in lst1:
    print("POSSIBLE")

elif k%p==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
import fractions
length, target = map(int, input().split(" "))
nums = sorted([int(n) for n in input().split(" ")])
minimum = min(nums)
odd, even, gcd = 0, 0, minimum
for n in nums:
    if n % 2 == 0:
        even = 1
    else:
        odd = 1
    gcd = fractions.gcd(gcd, n)
if target > max(nums):
    print("IMPOSSIBLE")
elif target in nums:
    print("POSSIBLE")
else:
    if gcd == 1:
        print("POSSIBLE")
    else:
        if target % gcd == 0:
            print("POSSIBLE")
        else:
            print("IMPOSSIBLE")

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

@mt
def slv(N, K, A):
    from fractions import gcd
    G = reduce(gcd, A)
    if K <= max(A) and K % G == 0:
        return 'POSSIBLE'
    else:
        return 'IMPOSSIBLE'

def main():
    N, K = read_int_n()
    A = read_int_n()
    print(slv(N, K, A))


if __name__ == '__main__':
    main()

Solution (Python):
import fractions
import functools

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
maximum = max(A)
lcm = functools.reduce(lambda a, b: fractions.gcd(a, b), A)
if K % lcm == 0 and K <= maximum:
    ans = "POSSIBLE"
else:
    ans = "IMPOSSIBLE"
print(ans)

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

def gcdlist(l):
    a = l[0]
    for i in range(1,len(l)):
        a = gcd(a,l[i])
    return a

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

g = gcdlist(A)
M = max(A)
if K > M:
    ans = 'IMPOSSIBLE'
elif K%g == 0:
    ans = 'POSSIBLE'
else:
    ans = 'IMPOSSIBLE'

print(ans)

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

def gcdlist(l):
    a = l[0]
    for i in range(1,len(l)):
        a = gcd(a,l[i])
    return a

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

g = gcdlist(A)
M = max(A)
if K > M:
    ans = 'IMPOSSIBLE'
elif K in A:
    ans = 'POSSIBLE'
elif K%g == 0:
    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(x,y):
    if y == 0: return x
    else: return gcd(y,x%y)

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

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

print(ans)

Solution (Python):
import fractions

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

if N == 1:
    if A[0] == K:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
else:
    G = A[0]
    for i in range(1,N):
        G = fractions.gcd(A[i],G)
    if K <= M and K % G == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Solution (Python):
from functools import reduce
from fractions import gcd
def gcds(a):
  return reduce(gcd, a)

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

Solution (Python):
N,K=map(int,input().split())
A=set(map(int,input().split()))
NO='IMPOSSIBLE'
YES='POSSIBLE'

max_A=max(A)
if K>max_A:
    print(NO)
    exit()

if K in A:
    print(YES)
    exit()

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

GCD=0
for n in A:
    GCD=gcd(GCD,n)

if GCD==1 or K%GCD==0:
    print(YES)
else:
    print(NO)

Solution (Python):
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline









N, K, = map(int, input().split())
L = [int(v) for v in input().split()]
L.sort()

if max(L) < K:
    print("IMPOSSIBLE")
    exit()

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

p = L[0]
for v in L:
    p = gcd(p, v)

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

Solution (Python):


import fractions
from functools import reduce
n,k = map(int, input().split())
A = list(map(int, input().split()))
gcd = reduce(fractions.gcd, A)
if (min(A)<=k and k<=max(A) and k%gcd==0):
    print ("POSSIBLE")
else:
    print ("IMPOSSIBLE")

Solution (Python):
from fractions import gcd
N, K = map(int, input().split())
a = list(map(int, input().split()))
g = 0

for i in range(N):
    g = gcd(a[i], g)
amax = max(a)
q, mod = divmod(K, g)

if mod != 0 or amax < K:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

Solution (Python):
from fractions import gcd
N, K = map(int, input().split())
a = list(map(int, input().split()))
g = 0

for i in range(N):
    g = gcd(a[i], g)
amax = max(a)
q, mod = divmod(K, g)

if mod != 0 or amax < K:
    print('IMPOSSIBLE')
else:
    if q <= amax:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')

Solution (Python):
import fractions
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
mx = a[-1]
if mx < k:
    ans = 'IMPOSSIBLE'
elif n == 1:
    if a[0] == k:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
else:
    gcd = fractions.gcd(a[0],a[1])
    for i in range(0,n):
        gcd = fractions.gcd(gcd,a[i])
    if k % gcd == 0:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
print(ans)

Solution (Python):
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N,K = map(int,input().split())
A = list(map(int,input().split()))
amax = max(A)
if K>amax:
    print("IMPOSSIBLE")
else:
    a = A[0]
    for i in range(1,N):
        a = gcd(a,A[i])
    if (amax-K)%a == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

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

def solve():
    n, k = LI()
    a = LI()
    if k in a:
        print("POSSIBLE")
        return
    if max(a) < k:
        print("IMPOSSIBLE")
        return
    g = a[0]
    for ai in a:
        g = gcd(g, ai)
    if k % g != 0:
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")
    return



if __name__ == '__main__':
    solve()

Solution (Python):
from fractions import gcd
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=float('inf')
if k>max(a):
  print('IMPOSSIBLE')
else:
  for i in range(n):
    b=min(gcd(a[0],a[i]),b)
  if k%b==0:
     print('POSSIBLE')
  else:
    print('IMPOSSIBLE')

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

N,K = map(int,input().split())
A = list(map(int,input().split()))
gcdA = reduce(gcd,A)
print('POSSIBLE' if K%gcdA ==0 and K<=max(A) else 'IMPOSSIBLE')

Solution (Python):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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



import fractions

N,K=two_int()

A=many_int()

if K <= max(A):
    temp=A[0]
    for a in A[1:]:
        temp = fractions.gcd(temp,a)

    if fractions.gcd(temp,K)!=1 or temp==1:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE") 

else:
    print("IMPOSSIBLE")

Solution (Python):
from functools import reduce
from fractions import gcd
n,k= map(int,input().split())
a = list(map(int,input().split()))
if k in a:
  print('POSSIBLE')
  exit()
elif k > max(a):
  print('IMPOSSIBLE')
  exit()
    
m = reduce(gcd, a)
for i in a:
  if (i - k) % m == 0:
    print('POSSIBLE')
    break
else:
  print('IMPOSSIBLE')

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

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

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

if(k in a):
	print("POSSIBLE")
	sys.exit()

maxa=max(a)
mindiff=a[0]
for i in range(len(a)-1):
	mindiff=fractions.gcd(mindiff,a[i])

a_more_k=[a[i] for i in range(len(a)) if a[i]>k]
for i in range(len(a_more_k)):
	if( (a_more_k[i]-k)%mindiff == 0):
		print("POSSIBLE")
		sys.exit()

print("IMPOSSIBLE")

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

diffs=[]
for i in range(len(A)):
  if A[i]>=K:
    diffs.append(A[i]-K)
    
def gcd(a,b):
  if a>b:
    a,b=b,a
  while a%b>0:
    a,b=b,a%b
  return b

g=A[0]
for i in range(1,len(A)):
  g=gcd(g,A[i])
  
for dif in diffs:
  if dif%g==0:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Solution (Python):
N,K=map(int,input().split())
A=list(map(int,input().split()))
if K in A:
  print("POSSIBLE")
  exit(0)
if K>max(A):
  print("IMPOSSIBLE")
  exit(0)

diffs=[]
for i in range(len(A)):
  if A[i]>K:
    diffs.append(A[i]-K)
    
def gcd(a,b):
  if a>b:
    a,b=b,a
  while a%b>0:
    a,b=b,a%b
  return b

g=A[0]
for i in range(1,len(A)):
  g=gcd(g,A[i])
  
for dif in diffs:
  if dif%g==0:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

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


def greatest_common_divisor(iter):
    '''
    最大公約数を返す
    '''
    return reduce(gcd, iter)


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

if K % greatest_common_divisor(A) != 0 or K > max(A):
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

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

ans = 'IMPOSSIBLE'
if max(A) >= K:
    
    from fractions import gcd
    from functools import reduce
    g = reduce(gcd,A)
    
    if K % g == 0: ans = 'POSSIBLE'

print(ans)

Solution (Python):
def gcd(x, y):
    if y == 0:
        return x
    while y != 0:
        x, y = y, x % y
    return x
def examA():
    N, K = LI()
    A = LI()
    ans = "POSSIBLE"
    if max(A)<K:
        ans = "IMPOSSIBLE"
    cur = A[0]
    for i in range(1,N):
        cur = gcd(cur,A[i])
    if K%cur!=0:
        ans = "IMPOSSIBLE"
    print(ans)
    return

def examB():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = 10**18

if __name__ == '__main__':
    examA()

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

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

A.sort()

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

if K in A or 1 in A:
    print("POSSIBLE")
    exit()

def gcd(a,b):
    x = max([a,b])
    y = min([a,b])
    while y:
        x, y = y, x % y
    return x

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

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

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

Solution (Python):
n, k = map(int, input().split())
a = list(map(int, input().split()))
new_balls = []
a.sort()
if k > a[-1]:
    print('IMPOSSIBLE')
    exit()
if k in a:
    print('POSSIBLE')
    exit()
for i in range(1, n):
    diff = a[i] - a[i - 1]
    if diff > 0:
        new_balls.append(diff)
for nb in new_balls:
    if (a[-1] - k) % nb == 0:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')

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

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

Solution (Python):
def gcd(l, r):
  while r > 0:
    l, r = r, l % r
  return l

def main():
  N, K, *A = map(int, open(0).read().split())
  g = A[0]
  for a in A:
    g = gcd(g, a)
  if K % g == 0 and K <= max(A):
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')

if __name__ == '__main__':
  main()

Solution (Python):
import fractions
from functools import reduce

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


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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from fractions import gcd
from functools import reduce

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

g = reduce(gcd,A)

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

Solution (Python):


import fractions as f
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k>max(a):
    print('IMPOSSIBLE')
else:
    if k in a:
        print('POSSIBLE')
    else:
        a.sort()
        cnt=[]
        count=[]
        s=a[0]
        for i in range(n-1):
            cnt.append(f.gcd(a[i],a[i+1]))
        cnt=list(set(cnt))
        ans=0
        for j in range(len(cnt)):
            if k%cnt[j]==0:
                ans=1
        if ans==1:
            print('POSSIBLE')
        else:
            print('IMPOSSIBLE')

Solution (Python):
n, k = [ int(v) for v in input().split() ]
num = [ int(v) for v in input().split() ]

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

g = gcd(num[0], num[0])
for i in num:
    g = gcd(g, i)

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

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

def run():
  N, K = map(int, input().split())
  A_li = list(map(int, input().split()))
  if K > max(A_li):
    print('IMPOSSIBLE')
    exit()
  factor = A_li[0]
  for A in A_li[1:]:
    factor = gcd(factor, A)
  if K%factor != 0:
    print('IMPOSSIBLE')
    exit()
  print('POSSIBLE')
  
if __name__ == '__main__':
  run()

Solution (Python):
import sys
n, k = [int(i) for i in sys.stdin.readline().split()]
a_ls = [int(i) for i in sys.stdin.readline().split()]

def gcd(ls):
    ls = [i for i in ls if i > 0]
    while True:
        _min = min(ls)
        ls = [i % _min for i in ls if i % _min != 0]
        if len(ls) == 0:
            return _min
        ls.append(_min)

_gcd = gcd(a_ls)
if max(a_ls) >= k and k % _gcd == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):
def gcm(a,b):
  a,b = max(a,b),min(a,b)
  while b != 0:
    a,b = b,a%b
  return a
n,k = map(int,input().split())
a = list(map(int,input().split()))
m = max(a)
g = a[0]
for i in a[1:]:
  g = gcm(g,i)
if m >= k and (m-k)%g == 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

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


if __name__ == "__main__":
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    max_a = max(a)
    while len(a) > 1:
        tmp = gcd(a.pop(), a.pop())
        a.append(tmp)

    if k % a[0] == 0:
        ans = "POSSIBLE"
    else:
        ans = "IMPOSSIBLE"
    if k > max_a:
        ans = "IMPOSSIBLE"
    print(ans)

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

Solution (Python):
N, K = map(int, input().split())
A = list(map(int, input().split()))
c = 0
for i in range(N):
  if A[i] == K:
    c = 1
if c == 0:
  if K <= max(A):
    for i in range(N-1):
      p, r = A[N-i-2], A[N-i-1]
      while r != 0:
        p, r = r, p % r
      A[N-i-2] = p
      if p == 1:
        break
    if K % p != 0:
      c = -1
    else:
      c = 1
  else:
    c = -1
if c > 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Solution (Python):
import fractions

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

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

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

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

N, K = map(int, input().split())
A =sorted(list(map(int, input().split())))
ans = ''
a = A[0]
for b in range(1, N):
    a = gcd(a, A[b])
if A[N-1] < K:
    ans = 'IMPOSSIBLE'
elif a == 1:
    ans = 'POSSIBLE'
else:
    for n in reversed(A):
        if (n - K) % a == 0:
            ans = 'POSSIBLE'
            break
        else:
            if n < K:
                break
if  ans == '':
    ans = 'IMPOSSIBLE'
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from fractions import gcd
def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    m=max(A)
    g=0
    for a in A:
        g=gcd(g,a)

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

Solution (Python):
from fractions import gcd
n,k=map(int,input().split())
g=0
m=0
for a in map(int,input().split()):
    g=gcd(g,a)
    m=max(m,a)

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

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

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

if m < K or (g > 1 and K % g > 0):
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")

Solution (Python):
from fractions import gcd

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

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

if K <= M and K % G == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):

import sys

YES = "POSSIBLE"  
NO = "IMPOSSIBLE"  

def solve(N: int, K: int, A: "List[int]"):
    if K in A:
        print(YES)
        return
    
    if max(A) < K:
        print(NO)
        return
    
    
    import fractions
    from functools import reduce
    def gcd_list(numbers):
        return reduce(fractions.gcd, numbers)
    
    if gcd_list(A) == 1:
        print(YES)
    else:
        if K%gcd_list(A) == 0:
            print(YES)
        else:
            print(NO)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)]  
    solve(N, K, A)

if __name__ == '__main__':
    main()