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())
A = list(map(int, input().split()))
import fractions

if K > max(A):
    print('IMPOSSIBLE')
else:
    g = A[0]
    for i in range(N - 1):
        g = fractions.gcd(g, A[i + 1])
    

    ok = False
    for val in A:
        if val >= K and (val - K) % g == 0:
            ok = True
    if ok:
        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()
g = A[0]
for i in range(1, N):
    g = gcd(g, A[i])
print('POSSIBLE' if (K <= A[-1] and K % g == 0) else 'IMPOSSIBLE')

Solution (Python):
from fractions import gcd

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

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

def solve():
    if K > A[-1]:
        return False
    return K % gcd_all() == 0

print('POSSIBLE' if solve() else 'IMPOSSIBLE')

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

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

Solution (Python):
from fractions import gcd
n,k=map(int,input().split())
A=list(map(int,input().split()))
if k>max(A):
    print('IMPOSSIBLE')
else:
    a=A[0]
    for i in range(n):
        a=gcd(a,A[i])
    if a==1 or k%a==0:
        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()
if k>A[-1]:
    print('IMPOSSIBLE')
else:
    a=A[0]
    for i in range(n):
        a=gcd(a,A[i])
    if a==1:
        print('POSSIBLE')
    else:
        if k%a==0:
            print('POSSIBLE')
        else:
            print('IMPOSSIBLE')

Solution (Python):
from fractions import gcd
n,k = map(int,input().split())
a = list(map(int,input().split()))
M = a[0]
g = a[0]
for i in range(1,n):
    M = max(M,a[i])
    g = gcd(g,a[i])
if k <= M and k % g == 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()]
g = A[0]
for a in A[1:]:
    g = gcd(a, g)
for a in A:
    if a >= K and (a - K) % g == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Solution (Python):
import fractions as f

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

if K <= A[-1]:
    GCD = A[0]
    for i in range(1, N):
        GCD = f.gcd(GCD, A[i])
    if K % GCD == 0:
        POSSIBLE = True

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

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,k = m()

a = l()

po = gcd_list(a)

fl = 0

for i in range(n):
    if a[i] >= k and (a[i]-k) % po == 0:
        fl = 1
if fl:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Solution (Python):










n, k = map(int, input().split())
arr = sorted(list(set(list(map(int, input().split())))))
n = len(arr)
if arr[0] == 1 or k in arr:
    print("POSSIBLE")
    exit()
if n < 2 or arr[-1] < k:
    print("IMPOSSIBLE")
    exit()


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


tmp = gcd(arr[0], arr[1])

if tmp == 1:
    print("POSSIBLE")
    exit()
flag = True
for i in range(2, n):
    g = gcd(tmp, arr[i])
    if g != tmp or g == 1:
        flag = False
        break

if flag and k % tmp != 0:
    print("IMPOSSIBLE")
    exit()

even_flag, odd_flag = False, False
for a in arr:
    if a % 2 == 1:
        odd_flag = True
    else:
        even_flag = True


if odd_flag:
    if k % 2 == 0 and not even_flag:
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")
    exit()


if k % 2 == 1:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

Solution (Python):
from fractions import gcd

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

Solution (Python):
import fractions
N,K=map(int,input().split())
a=list(map(int,input().split()))
bef=a[0]
gcd=a[0]
max_=a[0]
for i in range(1,N):
    if max_<a[i]:
        max_=a[i]
    gcd=fractions.gcd(gcd,a[i])
if max_<K:
    print("IMPOSSIBLE")
else:
    if 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()))

a_gcd = a[0]
for i in range(1, n):
    a_gcd = gcd(a_gcd, a[i])
ans = True
if k > max(a):
    ans = False
if k % a_gcd != 0:
    ans = False
if k in a:
    ans = True

print('POSSIBLE' if ans else 'IMPOSSIBLE')

Solution (Python):

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


from fractions import gcd
N, K = read_ints()
A = read_ints()



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

if min(A) <= 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()))
max_A = max(A)
A.sort()

if(max_A < K):
    print("IMPOSSIBLE")
else:
    num = 10**10
    for i in range(N-1):
        if(min(num, abs(A[i]-A[i+1]))):
            num = min(num, abs(A[i]-A[i+1]))

    for i in range(N):
        if(A[i] < K):
            continue
        if((K-A[i])%num == 0):
            print("POSSIBLE")
            break
    else:
        print("IMPOSSIBLE")

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

Solution (Python):
from fractions import gcd
N,K=map(int,input().split(' '))
A=sorted(list(map(int,input().split(' '))))
G=A[0]
for i in A[1:]:
    G=gcd(G,i)
if A[-1] >= K and K%G==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()))
A = set(A)

M = max(A)


def mgcd(x):
    return reduce(gcd, x)


if M < K:
    print("IMPOSSIBLE")
elif K in A:
    print("POSSIBLE")
else:
    G = mgcd(A)
    if K % G == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Solution (Python):
import fractions

N, K = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
A.sort()
diff = 10 ** 9

if max(A) < K:
    print('IMPOSSIBLE')
else:
    gcd = max(A)
    for i in range(N):
        gcd = fractions.gcd(gcd, A[i])

    if K % gcd == 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()))
m = max(a)
for i in range(1, n):
    a[i] = gcd(a[i], a[i - 1])
print("POSSIBLE" if k % a[n - 1] == 0 and k <= m else "IMPOSSIBLE")

Solution (Python):
import fractions

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

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

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

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

def gcd(n, m):
    
    a = max(n,m)
    b = min(n,m)
    while b:
        a, b = b, a % b
    return a

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

for a in As:
    if a >= K and (a-K) % g == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Solution (Python):

if True:
    import fractions

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

Solution (Python):
n,k=map(int,input().split())
l=sorted(map(int,input().split()))
def gcd(x,y):
  if y==0:return x
  return gcd(y,x%y)
ans=""
s=0
for i in l:
  s=gcd(i,s)
  if s==1:break
else:
  if k%s!=l[-1]%s:
    ans="IM"
if l[-1]<k:ans="IM"
print(ans+"POSSIBLE")

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


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


def S(): return input()


def MS(): return map(str, input().split())


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


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()

nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']



show_flg = False


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


def gcd_n(a, n):
    ans = a[0]
    for i in range(1, n):
        ans = gcd(ans, a[i])
    return ans


def main():
    N, K = MI()
    A = LI()
    A = sorted(A)
    mx = max(A)

    ret = gcd_n(A, N)

    if mx < K:
        print('IMPOSSIBLE')
        return

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

    
    
    
    
    

    
    

    

if __name__ == '__main__':
    main()

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

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


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

print("POSSIBLE" if (A[-1]-k) %
      smallest_ball == 0 and k <= A[-1] else "IMPOSSIBLE")

Solution (Python):
n, k = map(int, input().split())
A = sorted(map(int, input().split()))
INF = 10**9+1
diff = INF
for x, y in zip(A, A[1:]):
    z = abs(x-y)
    if z > 0:
        diff = min(diff, z)

MAX = A[-1]
ans = False
for a in A:
    if a-k < 0:
        continue
    x, r = divmod((a-k), diff)
    if r == 0:
        ans = True
        break
print("POSSIBLE" if ans else "IMPOSSIBLE")

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

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

N, K = map(int, input().split())
A = list(map(int, input().split()))
if max(A) < K:
    print('IMPOSSIBLE')
    exit()
res = A[0]
for i in range(1, N):
    a = A[i]
    b = res
    if a < b:
        a, b = b, a
    res = gcd(a, b)
if K % res == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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


def main():
    balls, target = map(int, input().split())
    numbers = [int(x) for x in input().split()]
    numbers.sort()
    numbers_gcd = reduce(gcd, numbers)
    print("POSSIBLE" if target % numbers_gcd == 0 and target <= numbers[-1] else "IMPOSSIBLE")


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N,K = map(int,input().split())
    A = set(map(int,input().split()))
    A = list(A)
    A.sort()
    if K > max(A):
        print("IMPOSSIBLE")
        exit()
    if K in A:
        print("POSSIBLE")
        exit()
    E = set(map(lambda x:abs(x-K),A))
    D = set(A)
    if E&D:
        print("POSSIBLE")
        exit()

    print("IMPOSSIBLE")
    

if __name__ == "__main__":
    main()

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

    E = list(map(lambda x:abs(x-K),A))
    E = set(E)
    C = [A[i+1]-A[i] for i in range(N-1)]
    C = set(C)
    D = set(A)
    if E&D:
        print("POSSIBLE")
        exit()

    print("IMPOSSIBLE")
    

if __name__ == "__main__":
    main()

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
mn=a[0]
mm=a[0]+1
mx=a[-1]
bool=1
b=[mx+1 for _ in range(len(a)-1)]
if mx<k:
  print("IMPOSSIBLE")
  exit()
if k in a:
  print("POSSIBLE")
  exit()
while bool==1:
  a=list(set(a))
  a.sort()
  b=[mx+1 for _ in range(len(a)-1)]
  p=a[0]
  for i in range(1,len(a)):
    x=a[i]
    b[i-1]=x-p
    if x>p:
      mm=min(mm,x-p)
    p=x
  if mm==mn:
    bool=0
  else:
    mn=mm
  b=[x for x in b if x!=0]
  a.extend(b)


if mn==1:
  print("POSSIBLE")
  exit()
elif (mx-k)%mn==0:
  print("POSSIBLE")
  exit()
else:
  print("IMPOSSIBLE")
  exit()



print(a,mn,mx,b)

Solution (Python):
import sys
import fractions

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

if k > max(a) :
  print('IMPOSSIBLE')
  sys.exit()
if k in a :
  print('POSSIBLE')
  sys.exit()
  
g = fractions.gcd(a[0],a[1])
for i in range(2,n) :
  g = fractions.gcd(g,a[i])
  
if k%g == 0 :
  print('POSSIBLE')
else :
  print('IMPOSSIBLE')

Solution (Python):

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


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

if len(A) == 1:
    if K == A[0]:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
elif K in A:
    ans = 'POSSIBLE'
elif K > max(A):
    ans = 'IMPOSSIBLE'
else:
    A.sort()

    

    a = A[0]
    lenA = len(A)
    for i in range(1,lenA):
        if A[i]%a > 0:
            b = A[i]
            break
        if i == lenA-1:
            b = A[1]

    while True:
        c = b - a
        if c == 0:
            break
        if c < a:
            b = a
            a = c
        else:
            b = c

    if K%a == 0:
        ans = 'POSSIBLE'
    else:
        ans = 'IMPOSSIBLE'
    

print(ans)

Solution (Python):

from fractions import gcd
from functools import reduce

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

  l = reduce(gcd, a)
  max_a = reduce(max, a)
  if k % l == 0 and max_a >= k:
    print("POSSIBLE")
  else:
    print("IMPOSSIBLE")

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

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

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

l = A.pop()
for a in A:
  l = gcd(l, a)

print('POSSIBLE' if k % l == 0 and maxA >= k else 'IMPOSSIBLE')

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, k = na()
a = na()

def gcd(m, n):
    if n == 0:
        return m
    else:
        return gcd(n, m % n)

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

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

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

if k > max(a):
    fl = "IMPOSSIBLE"

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

Solution (Python):
import sys
N,K=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
  if a==b:
    return a
  else:
    a,b=max(a,b),min(a,b)
    if a%b==0:
      return b
    else:
      return gcd(b,a%b)
if N==1:
  if K==a[0]:
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')
  sys.exit()
          
for i in range(N-1):
  if i==0:
    tmp=gcd(a[i],a[i+1])
  else:
    tmp=gcd(tmp,a[i+1])
if tmp==1:
  if K<=max(a):
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')
else:
  if K<=max(a):
    if K%tmp==0:
      print('POSSIBLE')
    else:
      print('IMPOSSIBLE')
  else:
    print('IMPOSSIBLE')

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

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

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


if K <= max(A) and K % gcd_list(A) == 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()))

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

Solution (Python):
from fractions import gcd
import functools

def gcd_list(l):
    return functools.reduce(gcd, l)

def solve():
    N,K = map(int, input().split())
    A = list(map(int, input().split()))
    d = gcd_list(A)
    ret = False
    if K > max(A):
        print('IMPOSSIBLE')
        return
    
    for a in A:
        if (a-K)%d == 0:
            ret = True
            break
            
    print('POSSIBLE' if ret else 'IMPOSSIBLE')
    
solve()

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

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

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()


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 i in range(1, n):
    g = gcd(g, a[i])
if k % g == 0 and max(a) >= k:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Solution (Python):
n,k = map(int,input().split())
a=list(map(int,input().split()))
def gcd(x,y):
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)
g=a[0]
for i in range(1,n):
    g=gcd(g,a[i])
if k>max(a):
    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 = sorted(list(map(int, input().split())))
if max(a) < k:
    print("IMPOSSIBLE")
    exit()
x = a[0]
for i in range(1,n):
    x = gcd(x, a[i])

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

Solution (Python):
from fractions import gcd

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

for i in range(n):
    if (a[i] - k) % x == 0:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")

Solution (Python):
from fractions import gcd

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

M = max(A)

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

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

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

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

from bisect import bisect_left

flag = False
for i in range(N):
    if A[i] == K:
        flag = True
    
    idx = bisect_left(A, K - A[i])
    if idx < N and i != idx and A[idx] == K - A[i]:
        flag = True

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

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

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

for v in A:
    if K==v:
        print("POSSIBLE")
        quit()
if K > A[0]:
    print("IMPOSSIBLE")
    quit()

d = []
for i in range(N-1):
    d.append(A[i]-A[i+1])

for v in d:
    if v:
        K %= v

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

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

L = sorted(A)
while N > 1:
    s = set()
    for i in range(len(L)-1):
        s.add(L[i+1]-L[i])
    L = list(s)
    L.sort()
    if L[0] == 1 or len(L) == 1:
        break

if K > max(A):
    ans = "IMPOSSIBLE"
elif K in A or L[0] == 1:
    ans = "POSSIBLE"
else:
    ans = "IMPOSSIBLE"
    for a in A:
        if a-K < 0:
            continue
        if (a-K)%L[0] == 0:
            ans = "POSSIBLE"
            break

print(ans)

Solution (Python):
n,k = map(int, input().split())
a = [int(s) for s in input().split()]

if k > max(a):
  print('IMPOSSIBLE')
elif min(a) == 1 or k in a:
  print('POSSIBLE')
else:
  divmax = min(a)
  divval = 1
  for div in range(divmax):
    for x in a:
      if x % (div+1) != 0:
        break
    else:
      divval = div + 1
  if k % divval == 0:
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')

Solution (Python):
def gcd(a,b):
	if(a==0 or b==0):
		return a+b
	return gcd(b,a%b)
n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
val=0
for c in l:
	val = gcd(val,c)
if(k%val==0 and k<=max(l)):
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Solution (Python):
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    x = a[0]
    for v in a:
        if v % x == 0:
            continue
        x = v % x
    f = False
    for v in a:
        if k <= v and (v-k)%x == 0:
            f = True
    if f:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

if __name__ == "__main__":
    main()

Solution (Python):
import fractions

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

if n == 1:
    print("POSSIBLE" if arr[0] == k else "IMPOSSIBLE")
else:
    
    gcd = arr[0]
    for num in arr[1:]:
        gcd = fractions.gcd(gcd, num)

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

Solution (Python):
n,k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
import fractions
num = a[0]
for i in range(1, n):
    num = fractions.gcd(num, a[i])

if k > a[-1]:
    print("IMPOSSIBLE")
elif (k in a) or (k%num==0):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

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

mm = A[0]

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

for i in range(N):
    if A[i]-K>=0 and (A[i]-K)%mm==0:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Solution (Python):
import fractions

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

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

if k % g == 0 and k <= A[-1]:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

import math
import fractions
flag=True

def union_gcd(lists):
    if len(lists)==1:
        return lists[0]
    elif len(lists)>1:
        num=lists[0]
        for i in range(1,len(lists)):
            num=fractions.gcd(num,lists[i])
        return num
if k%union_gcd(lists)==0 and k<=max(lists):
    flag=True
else:
    flag=False
if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

import fractions
ans=A[0]
for i in range(1,N):
  ans=fractions.gcd(ans,A[i])
if K>a:
  print('IMPOSSIBLE')
  exit()
if (a-K)%ans==0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Solution (Python):
import sys
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
A = [int(x) for x in input().strip().split()]

if K > max(A):
    print('IMPOSSIBLE')
    exit()
if K in A:
    print('POSSIBLE')
    exit()

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

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

if K % gcd_ == 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

if n == 1:
    gcd1 = a[0]
else:
    gcd1 = gcd(a[0], a[1])

    for i in range(2,n):
        gcd1 = gcd(gcd1,a[i])

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

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

a = [0] + a
a.sort()
if max(a) < k:
    print("IMPOSSIBLE")
    exit()

for i in range(len(a) - 1):
    if k == a[i]:
        print("POSSIBLE")
        break
    if a[i+1] - a[i] == 0: continue 
    if k % (a[i+1] - a[i]) == 0:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

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

Solution (Python):
import fractions
from functools import reduce

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

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

GCD = gcd_list(A)

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

Solution (Python):
from functools import reduce
from fractions import gcd
N,K,*A=map(int, open(0).read().split())
g=reduce(gcd, A)
if (g==gcd(g,K) or K in A) and K<=max(A):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

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 in A or max(A) > k and k % g == 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Solution (Python):
import sys
from fractions import gcd

input=sys.stdin.readline

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

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

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

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

from functools import reduce
from fractions import gcd

g = reduce(gcd, a)

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

Solution (Python):


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


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


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

m = gcdlist(al)
al.sort(reverse=True)

for a in al:
    if a>k:
        if (a-k)%m==0:
            print("POSSIBLE")
            exit()
    elif a==k:
        print("POSSIBLE")
        exit()
    else:
        break
print("IMPOSSIBLE")