Problem:
 Score : 100 points    Problem Statement There is a set A = \{ a_1, a_2, \ldots, a_N \} consisting of N positive integers.
Taro and Jiro will play the following game against each other.  Initially, we have a pile consisting of K stones.
The two players perform the following operation alternately, starting from Taro:   Choose an element x in A , and remove exactly x stones from the pile.   A player loses when he becomes unable to play.
Assuming that both players play optimally, determine the winner.      Constraints  All values in input are integers.  1 \leq N \leq 100  1 \leq K \leq 10^5  1 \leq a_1 < a_2 < \cdots < a_N \leq K         Input Input is given from Standard Input in the following format:  N  K  a_1  a_2  \ldots  a_N       Output If Taro will win, print First ; if Jiro will win, print Second .        Sample Input 1 2 4
2 3      Sample Output 1 First  If Taro removes three stones, Jiro cannot make a move.
Thus, Taro wins.       Sample Input 2 2 5
2 3      Sample Output 2 Second  Whatever Taro does in his operation, Jiro wins, as follows:   If Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.  If Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.        Sample Input 3 2 7
2 3      Sample Output 3 First  Taro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:   If Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.  If Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.        Sample Input 4 3 20
1 2 3      Sample Output 4 Second       Sample Input 5 3 21
1 2 3      Sample Output 5 First       Sample Input 6 1 100000
1      Sample Output 6 Second

Solution (Python):

n,k=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(k+1)
for i in range(1,k+1):
    for j in range(n):
        if i-a[j]>=0 and dp[i-a[j]]==0:
            dp[i]=1
print("First" if dp[k] else "Second")

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

dp = [False]*(K+1)

for i in range(K+1):
    for j in range(N):
        if i-A[j]>=0 and dp[i-A[j]] == False:
            dp[i] = True

        
if dp[K]:
    print("First")
else:
    print("Second")

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

dp = [False]*(k+1)

for stones in range(k+1):
    for x in arr:
        if stones >= x and dp[stones-x] == False:
            dp[stones] = True

if dp[k]:
    print("First")
else:
    print("Second")

Solution (Python):
def main():
    inp = lambda: [int(x) for x in input().split()]    
    n, k = inp()
    a = inp()
    min_a = min(a)
    dp = [False] * (k+1)
    for i in range(k + 1):
        if i < min_a:
            dp[i] = False
        elif i in a:
            dp[i] = True
        else:
            for j in a:
                if i >= j and not dp[i-j]:
                    dp[i] = True
                    break

    ans = "First" if dp[k] else "Second"
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    inp = lambda: [int(x) for x in input().split()]    
    n, k = inp()
    a = inp()
    min_a = min(a)
    dp = [False] * (k+1)
    for i in range(k + 1):
        if i < min_a:
            dp[i] = False
        elif i in a:
            dp[i] = True
        else:
            for j in a:
                if i >= j and not dp[i-j]:
                    dp[i] = True
                    break

    ans = "First" if dp[k] else "Second"
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def solve(k, a):
    dp = [False]*(k+1)
    for i in range(1, k+1):
        for x in a:
            if i - x >= 0:
                dp[i] = dp[i] or not dp[i-x]
    return dp[-1]

n, k = map(int, input().split())
a = list(map(int, input().split()))
print('First' if solve(k, a) else 'Second')

Solution (Python):

n,k=list(map(int,input().split(" ")))
a=list(map(int,input().split(" ")))
mat=[]
a=list(set(a))
res=["L"]*(k+1)
z=min(a)
for i in range(1,k+1):
	if(i in a):
		
		res[i]="W"
	else:
		flag=False
		for j in range(len(a)):
			
			
			if((i-a[j])>=0 and res[i-a[j]]=="L" and i>=z):
				
				flag=True
				break
		if(flag==True):
			
			res[i]="W"

if(res[k]=="W"):
	print("First")
else:
	print("Second")

Solution (Python):
def canWinNim(n: int, stones: list):
    states = [False] * (n+1)
    for i in range(1, n+1):
        for step in stones:
            if not states[i-step] and i-step >= 0:
                states[i] = True
    return 'First' if states[-1] else 'Second'

N, K = tuple(map(int, input().split()))
stones = list(map(int, input().split()))
print(canWinNim(K, stones))

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

arr  = [int(x) for x in input().split()]



dp = [False]*(k+1)

dp[0] = False


for i in range(1,k+1):
    for e in arr:
        if i - e < 0:
            dp[i] = False
            break
        if dp[i-e] == False:
            dp[i] = True
            break


if dp[k]:
    print('First')
else:
    print('Second')

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

dp = [False]*(k+1)


for i,x in enumerate(dp):
    if not x:        
        for ai in a:
            if i+ai <= k:dp[i+ai] = True
    

if dp[k]:print('First')
else : print('Second')

Solution (Python):
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
dp = [False] * (k + 1)
for i in range(1, k + 1):
    ok = False
    for j in a:
        if i - j >= 0:
            ok = ok or (not dp[i - j])
    dp[i] = ok

if dp[-1]:
    print("First")
else:
    print("Second")

Solution (Python):
N, K = map(int, input().split())
a = list(map(int, input().split()))
dp = [[-1,0] for i in range(K+1)]
for i in range(K+1):
    for j in range(N):
        if i+a[j]<=K:
            if dp[i+a[j]][1] == 0:
                dp[i+a[j]][0] = dp[i][0]*(-1)
                dp[i+a[j]][1] = 1
            else:
                if dp[i][0] == -1:
                    dp[i+a[j]][0] = 1 
if dp[K][0] == 1:
    print('First')
else:
    print('Second')

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


dp=[-1]*(K+1)
dp[0]=0

for i in range(1,K+1):
    if all(dp[i-a[j]] if i-a[j]>=0 else 1 for j in range(N)):
        dp[i]=0
    else:
        dp[i]=1

print('First' if dp[K] else 'Second')

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

dp = [False]*(k+1)
for i in range(1,k+1):
    flag = False
    for j in range(n):
        if i-A[j] >= 0:
            if dp[i-A[j]] == False:
                flag = True
                break
    if flag:
        dp[i] = True
    else:
        dp[i] = False
if dp[k]:
    print('First')
else:
    print('Second')

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

def main():
    N,M = map(int,input().split())
    a = list(map(int,input().split()))
    
    dp = [False for _ in range(M+1)]

    for i in range(M+1):
        for num in a:
            if i-num<0:
                continue
            if dp[i-num] == False:
                dp[i] = True

    if dp[M]:
        print("First")
    else:
        print("Second")
   
if __name__ == "__main__":
    main()

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

dp = [-1]*(k+1)
dp[0] = 0


for i in range(1,k+1):
    j = 0
    while j < n and a[j] <= i:
        if dp[i-a[j]] == 0:
            dp[i] = 1
            break
        j += 1
    if dp[i] == -1:
        dp[i] = 0
if dp[k] == 1:
    print('First')
else:
    print('Second')

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

dp = [False] * (K+1)

for i in range(1, K+1):
    for j in range(N):
        if 0 <= i - a[j] and not dp[i-a[j]]:
            dp[i] = True
            break

print("First" if dp[K] else "Second")

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

dp = [False] * (K+1)

for i in range(1, K+1):
    for j in range(N):
        if 0 <= i - a[j] and not dp[i-a[j]]:
            dp[i] = True

print("First" if dp[K] else "Second")

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7

N, K = MAP()
a = LIST()

dp = [0]*(K+1)

for i in range(1, K+1):
	for x in a:
		if i - x >= 0 and dp[i-x] == 0:
			dp[i] = 1

if dp[K]:
    print("First")
else:
    print("Second")

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

dp = [0 for i in range(k+1)]

for i in range(1,k+1):
    for j in range(n):
        if i - A[j] >= 0 and dp[i-A[j]] == 0:
            dp[i] = 1
if dp[k]:
    print("First")
else:
    print("Second")

Solution (Python):
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
dp = [0] * (K + 1)
for i in range(K):
  for x in a:
    if i + x <= K:
      if dp[i] == 0: dp[i + x] = 1
if dp[-1]: print("First")
else: print("Second")

Solution (Python):
import sys
input=sys.stdin.readline
def main():
    N, K = map(int, input().split())
    lst_a = list(map(int, input().split()))
    
    dp = [False] * (K+1)
    for i in range(1, K+1):
        for j in range(N):
            if i - lst_a[j] >= 0:
                dp[i] |= not(dp[i - lst_a[j]])
    
    if dp[K]:
        print('First')
    else:
        print('Second')
main()

Solution (Python):
import sys
input=sys.stdin.readline
def main():
    N, K = map(int, input().split())
    lst_a = list(map(int, input().split()))
    
    dp = [False] * (K+1)
    for i in range(1, K+1):
        for j in range(N):
            if i - lst_a[j] >= 0:
                dp[i] |= not(dp[i - lst_a[j]])
    
    if dp[K]:
        print('First')
    else:
        print('Second')
main()

Solution (Python):
def main():
    N, K = map(int, input().split())
    lst_a = list(map(int, input().split()))
    
    dp = [False] * (K+1)
    for i in range(1, K+1):
        for j in range(N):
            if i - lst_a[j] >= 0:
                dp[i] |= not(dp[i - lst_a[j]])
    
    if dp[K]:
        print('First')
    else:
        print('Second')
main()

Solution (Python):
import sys

input = sys.stdin.readline
def main():
    N, K = map(int, input().split())
    lst_a = list(map(int, input().split()))
    
    dp = [False] * (K+1)
    for i in range(1, K+1):
        for j in range(N):
            if i - lst_a[j] >= 0:
                dp[i] |= not(dp[i - lst_a[j]])
    
    if dp[K]:
        print('First')
    else:
        print('Second')
main()

Solution (Python):
N,K=map(int, input().split())
A=list(map(int,input().split()))
dp=[0]*(K+1)
for i in range(K+1):
  for j in A:
    if (i>=j) and (dp[i-j]==0):
      dp[i]=1
if dp[K]:
  print('First')
else:
  print('Second')

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

dp = [False]*(k+1)

for stones in range(k+1):
    for x in arr:
        if stones >= x and dp[stones-x] == False:
            dp[stones] = True

if dp[k]:
    print("First")
else:
    print("Second")

Solution (Python):
def main():
    N, K, *A = map(int, open(0).read().split())
    dp = [0] * (K + 1)
    for i in range(K):
        if dp[i]:
            continue
        for a in A:
            if i + a > K:
                break
            dp[i + a] = 1
    print("First" if dp[-1] else "Second")
if __name__ == "__main__":
    main()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate
    
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    

    
    

    N,K = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [0]*(K+1)
    for i in range(1, K+1):
        for j in a:
            if i-j < 0:
                continue
            if dp[i-j] == 0:
                dp[i] = 1
                break
    if dp[K]:
        print('First')
    else:
        print('Second')

if __name__ == '__main__':
    main()

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


dp = [0 for _ in range(K+1)]




  
for i in range(K + 1):
    
    
    
    
    for a in A:
        
        if i - a >= 0 and not dp[i - a]:
            dp[i] = 1
            break

if dp[K]:
    print('First')
else:
    print('Second')

Solution (Python):
n,k=list(int(i) for i in input().split())
A=list(int(i) for i in input().split())
dp=[[0 for i in range(k+1)] for j in range(2)]
for i in range(k+1):
    for j in range(n):
        if i>=A[j]:
            if dp[1][i-A[j]] is "First":
                dp[0][i]="First"
            if dp[0][i-A[j]] is "Second":
                dp[1][i]="Second"
    if dp[0][i]==0:
        dp[0][i]="Second"
    if dp[1][i]==0:
        dp[1][i]="First"
print(dp[0][-1])

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()

  
  dp=[0]*(k+1)
  for i in range(k+1):
    for x in l:
      y=i+x

      if y<=k:
        if dp[y]==0:
          dp[y]=abs(dp[i]-1)
  

  if dp[k]==1:
    return 'First'
  return 'Second'


print(main())

Solution (Python):
n,k=map(int,input().split())
A=list(map(int,input().split()))
dp=[0]*(2*k)
for i in range(k+1):
  a=0
  for j in range(n):
    if dp[i-A[j]]==1:
      a=1
  if a==0:
    dp[i]=1
if dp[k]==0:
  print("First")
else:
  print("Second")

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

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

dp = [''] * (k + 1)

for i in range(a[0]):
    dp[i] = 'Second'

for x in a:
    dp[x] = 'First'

for i in range(1, k + 1):
    if dp[i] != '':
        continue

    dp[i] = 'Second'
    for x in a:
        if x > i:
            continue
        if dp[i-x] == 'Second':
            dp[i] = 'First'
            break

print(dp[-1])

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

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

dp = [''] * (k + 1)

for i in range(a[0]):
    dp[i] = 'Second'

for x in a:
    dp[x] = 'First'

for i in range(1, k + 1):
    if dp[i] != '':
        continue

    dp[i] = 'Second'
    for x in a:
        if x > i:
            continue
        if dp[i-x] == 'Second':
            dp[i] = 'First'
            break

print(dp[-1])

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

dp = [False]*(K+1)
for i in range(1,K+1):
    for step in a:
        if i - step >= 0:
            dp[i] |= not dp[i-step]
if dp[K]:
    print('First')
else:
    print('Second')

Solution (Python):
n,k = map(int,input().split())
a = list(map(int,input().split()))
dp = [0]*(k+1)
for i in range(1,k+1):
  flg = 0
  for j in a:
    if i-j>=0:
      flg |= 1-dp[i-j]
  dp[i] = flg
if dp[k]:
  print("First")
else:
  print("Second")

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

dp = [False]*(K+1)

for i in range(1,K+1):
    
    judge = False
    
    for stone in a:
        
        if i - stone < 0:
            break
        
        if dp[i-stone] == False:
            judge = True
            break
    dp[i] = judge
            
print('First' if dp[K] else 'Second')

Solution (Python):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	for i in L:
		if n >= i:
			if fn(n-i) == 1:
				dp[n] = 0
				return 0
	dp[n] = 1
	return 1
for l in range(1, 	K):
	fn(l)
if fn(K) == 0:
	print("First")
else:
	print("Second")

Solution (Python):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	for i in L:
		if n >= i:
			if fn(n-i) == 1:
				dp[n] = 0
				return 0
	dp[n] = 1
	return 1
for l in range(1, 	K):
	fn(l)
if fn(K) == 0:
	print("First")
else:
	print("Second")

Solution (Python):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]

def fn(n):
	if dp[n] != -1:
		return dp[n]
	if n == 0:
		dp[n] = 0
		return dp[n]
	ans = 0
	for i in L:
		if n >= i:
			if fn(n-i) == 0:
				ans = 1
				break
	dp[n] = ans		
	return dp[n]
for l in range(K):
	fn(l)
if fn(K) == 1:
	print("First")
else:
	print("Second")

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

dp = [False] * (K+1)
for i in range(1, K+1):
    for j in range(N):
        if i - A[j] >= 0 and not dp[i - A[j]]:
            dp[i] = True
            break
if dp[K]:
    print('First')
else:
    print('Second')

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

dp = [False for _ in range(k+1)]

for i in range(1, k+1):
  for j in stones:
    if i >= j and dp[i-j] == False:
      dp[i] = True
      continue
      
if dp[k]:
  print("First")
else:
  print("Second")

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

"""
dp[i]: 残りの石の個数がiの局面で手番が回ってきたときに勝つか負けるか。(boolean)
"""
dp = [False] * (K + 1)

for i in range(K+1):
    for a in A:
        if i - a >= 0:
            if not dp[i - a]:
                dp[i] = True
                continue
if dp[K]:
    print("First")
else:
    print("Second")

Solution (Python):

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

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

gr = [0] * (K+1)

for i in range(K+1):

    mex = [0] * (N+1)
    for j in a:
        if i-j >= 0:
            mex[gr[i-j]] = 1

    for k in range(N+1):
        if mex[k] == 0:
            gr[i] = k
            break

if gr[-1] == 0:
    print ("Second")
else:
    print ("First")

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

dp = [False for i in range(k+1)]
for i in range(n):
    dp[a[i]] = True

for i in range(k+1):
    if dp[i] == False:
        for j in range(n):
            if i + a[j] <= k:
                dp[i+a[j]] = True
if dp[k]:
    print("First")
else:
    print("Second")

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

dp = [[None] * (k + 1) for _ in range(2)]






















for at in range(k + 1):
    for taro in range(2):
        if at == 0:
            dp[taro][at] = not taro
            continue
        results = []
        for i in range(n):
            if at >= a[i]:
                results.append(dp[not taro][at - a[i]])

        if not results:
            dp[taro][at] = not taro
            continue
        dp[taro][at] = (any if taro else all)(results)
print('First' if dp[True][k] else 'Second')

Solution (Python):
N, K = map(int, input().split())
*A, = map(int, input().split())
dp = [False] * (K+1)
for i in range(1, K+1):
    for a in A:
        if i - a < 0: break
        dp[i] |= not dp[i-a]
print('First' if dp[K] else 'Second')

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

dp=[False]*(K+1)

for i in range(N):
    dp[a[i]]=True

for k in range(K+1):
    for n in range(N):
        if k>=a[n]:
            dp[k]=not dp[k-a[n]]
        if dp[k] is True:
            break

if dp[-1] is True:
    print("First")
else:
    print("Second")

Solution (Python):

def main():
    N, K, *A = map(int, open(0).read().split())
    dp = [0] * (K + 1)
    for i in range(K):
        for a in A:
            if i + a > K:
                break
            dp[i + a] |= dp[i] ^ 1
    print("First" if dp[-1] else "Second")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, K, *A = map(int, open(0).read().split())
    dp = [False] * (K + 1)  
    for i in range(K):
        if dp[i]:
            continue
        for a in A:
            if i + a > K:
                break
            dp[i + a] = True
            if dp[-1]:
                print("First")
                return
    print("Second")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, K, *A = map(int, open(0).read().split())
    dp = [False] * (K + 1)
    for i in range(K):
        if dp[i]:
            continue
        for a in A:
            if i + a > K:
                break
            dp[i + a] = True
    print("First" if dp[-1] else "Second")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, K, *A = map(int, open(0).read().split())
    dp = [0] * (K + 1)
    for i in range(1, K + 1):
        for a in A:
            if i - a >= 0:
                dp[i] |= dp[i - a] ^ 1
            if dp[i]:
                break
    print("First" if dp[-1] else "Second")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, K, *A = map(int, open(0).read().split())
    dp = [0] * (K + 1)
    for i in range(1, K + 1):
        for a in A:
            if i - a >= 0:
                dp[i] |= dp[i - a] ^ 1
    print("First" if dp[-1] else "Second")


if __name__ == "__main__":
    main()

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

dp = [False] * (K + 1)
for i in range(1, K + 1):
    
    for a in A:
        if i - a < 0:
            break
        if dp[i - a] == False:
            dp[i] = True
            break


if dp[-1]:
    print ('First')
else:
    print ('Second')

Solution (Python):
import resource
import sys
from functools import lru_cache
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.reverse()
sys.setrecursionlimit(1000000)

@lru_cache(maxsize=None)
def f(k, p):
  for a in A:
    if k >= a:
      if f(k-a, p ^ 1) == p:
        return p
  return p ^ 1

print('First' if f(K, 0) == 0 else 'Second')

Solution (Python):

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


dp = ["W"] * (K + 1)

for i in range(K):
  if dp[K - i] == "W":
    for j in range(N):
      if K - i - a[j] < 0:
        continue
      dp[K - i - a[j]] = "L"

if dp[0] == "W":
  print("Second")
else:
  print("First")

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,k=map(int,input().split())
A=list(map(int,input().split()))
dp = [False]*(k+1)
for left in range(k+1):
  for i, ai in enumerate(A):
    if left - ai >= 0:dp[left] |= not dp[left-ai]
print("First"if dp[k] else "Second")

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,k=map(int,input().split())
A=list(map(int,input().split()))
mina = min(A)
dp = [0]*(k+1)
for left in range(k+1):
  win = False
  for i, ai in enumerate(A):
    if left - ai >= 0 and dp[left-ai] == 0:
      win = True
    dp[left] = (1 if win else 0)
print("First"if dp[k] else "Second")

Solution (Python):
N, K = map(int, input().split())
A = list(map(int, input().split()))
dp = [False for _ in range(K+1)]
dp[0] = False
for i in range(1, K+1):
    for a in A:
        if i - a >= 0:
            if not dp[i-a]:
                dp[i] = True
                break
if dp[K]:
    print("First")
else:
    print("Second")

Solution (Python):
N, K = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
arr.sort()
mem = [False for i in range(K+1)]
mem[0] = False
for i in range(K):
  local_result = mem[i]
  for j in arr:
    if i+j <= K:
      mem[i+j] =  mem[i+j] or not local_result
mem[0] = True

if mem[K]:
  print("First") 
else:
  print("Second")

Solution (Python):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue


Mod = 1000000007
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)



        
def main(): 
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    dp = [-1]*(k+1)
    for i in range(k+1):
        dp[i] = 0
        for j in range(n):
            if a[j] > i:
                break
            if 1 ^ dp[i-a[j]]:
                dp[i] = 1
                break

    print("First" if dp[k] else "Second")
if __name__ == "__main__":
    main()

Solution (Python):


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


dp=[0]*(K+1)

for i in range(N):
    dp[a[i]]=1
    
for i in range(K+1):
    if dp[i]==0:
        for j in range(N):
            if i-a[j]>=0:
                if dp[i-a[j]]==0:
                    dp[i]=1
                    break
                    
if dp[-1]==1:
    print("First")
else:
    print("Second")

Solution (Python):
def main():
  n,k=map(int,input().split())
  num=[int(i) for i in input().split()]
  
  dp=[0]*(k+1)
  for i in range(k):
    flag=False
    for j in range(n):
      if i+1-num[j]>=0:
        if  dp[i+1-num[j]]==0:
          flag=True
          break
    if flag:
      dp[i+1]=1
    else:
      continue
  if dp[k]:
    print('First')
  else:
    print('Second')          
if __name__=='__main__':
  main()

Solution (Python):
def main():
  n,k=map(int,input().split())
  num=[int(i) for i in input().split()]
  
  dp=[0]*(k+1)
  for i in range(k):
    flag=False
    for j in range(n):
      if i+1-num[j]>=0:
        if  dp[i+1-num[j]]==0:
          flag=True
          break
    if flag:
      dp[i+1]=1
    else:
      continue
  if dp[k]:
    print('First')
  else:
    print('Second')          
if __name__=='__main__':
  main()

Solution (Python):


def main():
    import sys
    readline = sys.stdin.readline

    n, k = map(int, readline().rstrip().split())
    *a, = sorted(map(int, readline().split()))

    dp = [False] * (k + 1)
    dp[0] = False
    

    for i in range(1, k + 1):
        for x in a:
            if x > i: break
            if not dp[i - x]:
                dp[i] = True
                break

    print('First' if dp[k] else 'Second')


if __name__ == '__main__':
    main()

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

dp = [-1]*(k+1)
dp[0] = 0

for i in range(1, k+1):
  temp = 1
  for j in range(n):
    if i - l[j] >= 0:
      temp *= dp[i-l[j]]
  dp[i] = 1-temp
      
if dp[k] == 0:
  print('Second')
else:
  print('First')

Solution (Python):
N, K = map(int, input().split())
A = list(map(int, input().split()))
dp = [False] * (2 * K + 1)

for i in range(K, 0, -1):
  if all([not dp[i+j] for j in A]):
    dp[i] = True

print("First" if any([dp[i] for i in A]) else "Second")

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,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 fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K = MI()
    A = LI()
    can_win = [False]*(K+1) 

    for i in range(1,K+1):
        for a in A:
            if a<=i:
                if not can_win[i-a]: 
                    can_win[i] = True
                    break
    print(("Second","First")[can_win[-1]])

if __name__ == '__main__':
    main()

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

dp = [-1]*(k+1)

for i in range(1,k+1):
  for j in range(n):
    if i >= aa[j]:
      dp[i] = max(dp[i],-dp[i-aa[j]])

if dp[k]>0:
  print('First')  
else:
  print('Second')

Solution (Python):
N,K = map(int,input().split())
A = list(map(int,input().split()))
dp = [False for i in range(K+1)]
for i in range(1,K+1):
    for j in range(N):
        if i-A[j] >= 0:
            dp[i] |= not dp[i-A[j]]
if dp[-1]:
    print('First')
else:
    print('Second')

Solution (Python):
n,k=map(int,input().split())
A=list(map(int,input().split()))
dp=[False] * (k+1)
for i in range(k):
    for j in range(n):
        if dp[i]==False and i+A[j]<=k:
            dp[i+A[j]]=True
print('First' if dp[k] else 'Second')

Solution (Python):
n,k=map(int,input().split())
A=sorted(map(int,input().split()))
dp=[0]*(k+1)
dp[1]=0
for i in range(k):
    if dp[i]==0:
        for a in A:
            if i+a<=k:
                dp[i+a]=1
print("Second"if dp[k]==0 else"First")