Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

S=input()
Q=int(input())

query=[""]*Q
for i in range(Q):
    query[i]=input()

#print(query)

#Q is length
flag=0
for i in query:
    
        a=i.split(" ")
        if(len(a)==1):
            #S=S[::-1]
            flag+=1
        else:
            if(flag==0):
                if(a[1]=="1"):
                    S=a[2]+S
                else:
                    S+=a[2]
            else:
                if(a[1]=="2"):
                    S=a[2]+S
                else:
                    S+=a[2]

        flag=flag%2

if(flag==1):
    S=S[::-1]
print(S)



### FIXED CODE ###

S=input()
Q=int(input())

flag=0
forward=""
back=""
for i in range(Q):
    #query[i]=input()
    b=input()

    if(len(b)==1):
        #S=S[::-1]
        flag+=1
    else:
        a=b.split(" ")
        if(flag==0):
            if(a[1]=="1"):
                #S=a[2]+S
                forward=a[2]+forward
            else:
                #S+=a[2]
                back=back+a[2]
        else:
            if(a[1]=="1"):
                #S=a[2]+S
                back=back+a[2]
            else:
                #S+=a[2]
                forward=a[2]+forward
                
    flag=flag%2

S=forward+S+back
if(flag==1):
    S=S[::-1]
print(S)
### BUGGY CODE ###

N = int(input())
train = [[] for _ in range(N)]
take_time = []
for cnt in range(N - 1):
    x, y , z = map(int,input().split())
    take_time.append(x)
    for _ in range(10**7+1):
        train[cnt].append(y)
        y += z

from bisect import bisect_left
for place in range(N):
    now = 0
    for i in range(place,N - 1):
        index = bisect_left(train[i],now)
        now = train[i][index]
        now += take_time[i]
    print(now)



### FIXED CODE ###

N = int(input())
train = [[] for _ in range(N)]
L = []
for cnt in range(N - 1):
    l = list(map(int,input().split()))
    L.append(l)

from math import ceil

from bisect import bisect_left
for place in range(N):
    now = 0
    for i in range(place,N - 1):
        k = max(0,ceil((now - L[i][1]) / L[i][2]))
        now = L[i][1] + L[i][2] * k
        now += L[i][0]
    print(now)
### BUGGY CODE ###

n,p = list(map(int,input().split()))
S = [int(s) for s in input()]

if p == 2 or p == 5:
  ans = 0
  for i,s in enumerate(S):
    if s%p == 0:
      ans += i+1
  print(ans)
  exit()

def MS(i,s,pre):
  return (s*(10**i) +pre)%p
 
M = [0]*p
pre = 0
ans = 0
for i,s in enumerate(S[::-1]):
  M[MS(i,s,pre)] += 1
  pre = MS(i,s,pre)

M[0] += 1
ans = sum(map(lambda m:(m*(m-1))//2, M))
print(ans)


### FIXED CODE ###

n,p = list(map(int,input().split()))
S = input()

if p == 2 or p == 5:
  ans = 0
  for i,s in enumerate(S):
    if int(s)%p == 0:
      ans += i+1
  print(ans)
  exit()

def MS(i,s,pre):
  return (s*i +pre)%p
 
M = [0]*p
M[0] = 1
t = 1
now = 0
for i in S[::-1]:
    i = int(i)
    now += i*t
    now %= p
    M[now] += 1
    t = t*10%p

ans = sum(map(lambda m:(m*(m-1))//2, M))
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
S =[]
for i in range(1,N+1):
  a =A.index(i)+1
  S.append(str(a))
S =' '.join(S)
print(S)
 

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
D = [0]*N
for i in range(N):
  a = A[i]
  D[a-1] = i+1
d = str(D[0])
for i in range(1,N):
  d += ' '+str(D[i])
print(d)
### BUGGY CODE ###

import bisect

n, m = map(int, input().split())
cities = [[] for _ in range(n)]
ans = [None] * m
idxMap = {}

for i in range(m):
    p, y = map(int, input().split())
    idx = bisect.bisect_left(cities[p-1], y)
    cities[p-1].insert(idx, y)
    idxMap[y] = i

    # ans.append(str(p).zfill(6) + str(idx+1).zfill(6))
    # py.append(list(map(int, input().split())))

for i in range(n):
    for j in range(len(cities[i])):
        year = cities[i][j]
        idx = idxMap[year]
        ans[idx] = str(i+1).zfill(6) + str(j+1).zfill(6)

# print(cities)
for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

import bisect

n, m = map(int, input().split())
cities = [[] for _ in range(n)]
ans = [None] * m
idxMap = {}

for i in range(m):
    p, y = map(int, input().split())
    # bisect.insort_left(cities[p-1], y)
    cities[p-1].append(y)
    idxMap[y] = i

    # ans.append(str(p).zfill(6) + str(idx+1).zfill(6))
    # py.append(list(map(int, input().split())))

for i in range(n):
    cities[i].sort()

# print('cities:', cities)

for i in range(n):
    for j in range(len(cities[i])):
        year = cities[i][j]
        idx = idxMap[year]
        ans[idx] = str(i+1).zfill(6) + str(j+1).zfill(6)

# print(cities)
for i in range(len(ans)):
    print(ans[i])
### BUGGY CODE ###

N,K,C =map(int,input().rstrip().split(" "))
S = input()
route = []
tyousa = [0 for _ in range(N)]
kinmu = 0
niti = 0
p = 0
for i in range(N):
  if S[i] == "o" and tyousa[i] == p:
    kinmu = 0
    niti = 0
    route.clear()
    while kinmu < K and niti < N:
      if S[niti] == "o" and niti != i:
        route.append(niti)
        kinmu += 1
        niti += C
      niti += 1
    if niti >= N and kinmu < K:
      print(i + 1)
    if kinmu >= K:
      for i2 in route:
        tyousa[i2] += 1
      p += 1

### FIXED CODE ###

N,K,C =map(int,input().rstrip().split(" "))
S = input()
kinmu = 0
niti = 0
f = []
b = []
kinmu = 0
niti = 0
while kinmu < K and niti < N:
  if S[niti] == "o":
    f.append(niti)
    kinmu += 1
    niti += C
  niti += 1
kinmu = 0
niti = N -1
while kinmu < K and niti >= 0:
  if S[niti] == "o":
    b.append(niti)
    kinmu += 1
    niti -= C
  niti -= 1
b.reverse()
for i in range(K):
  if f[i] == b[i]:
    print(f[i] + 1)
### BUGGY CODE ###

n = int(input())
a = []
a = list(map(int, input().split()))
total = 1
if 0 in a:
    total = 0
else:
    for num in a:
        total *= num
    if total > 10**18:
        total = -1

print(total)

### FIXED CODE ###

n = int(input())
a = []
a = list(map(int, input().split()))
total = 1
if 0 in a:
    total = 0
else:
    for num in a:
        total *= num
        if total > 10**18:
            total = -1
            break

print(total)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

def enum_prime(m):
    L = range(2, m)
    P = []
    while L[0] ** 2 < m:
        P.append(L[0])
        L = [i for i in L if i % P[-1]]
    return P + L

P = enum_prime(50000)
length = len(P)

for line in stdin:
    if line.startswith('0'):
        break
    n = int(line)
    cnt = 0
    if (n - 2) in P:
        cnt = 1
    elif n % 2 == 0:
        for i in xrange(length):
            for j in xrange(i, length):
                s = P[i] + P[j]
                if s >= n:
                    if s == n:
                        cnt += 1
                    break
    print(cnt)

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

def enum_prime(m):
    L = [True for _ in xrange(m + 1)]
    L[0] = L[1] = False

    for i in xrange(2, m + 1):
        if L[i]:
            for j in xrange(i + i, m + 1, i):
                L[j] = False
            if m < i * i:
                break
    return L

FLAGS = enum_prime(50000)
PRIMES = [i for i, isprime in enumerate(FLAGS) if isprime]

for line in stdin:
    if line.startswith('0'):
        break
    n = int(line)
    n2 = n // 2
    cnt = 0
    if n % 2 == 0:
        for p in PRIMES:
            if p > n2:
                break
            if FLAGS[n - p]:
                cnt += 1
    elif FLAGS[n - 2]:
        cnt = 1
    print(cnt)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
b = 0
for i in range(n):
    for j in range(1,n - i):
        b += a[i]*a[i + j]
        b %= (10**9 + 7)
       

print(b)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
s = sum(a)
ans = 0
for i in range(n):
    s -= a[i]
    ans += a[i]*s
    ans %= mod
print(ans)
### BUGGY CODE ###

import queue

n,m = map(int, input().split())
a = [[] for i in range(n)]

for i in range(m):
    u,v = map(int, input().split())
    u-=1
    v-=1
    a[u].append(v)

s,t = map(int, input().split())
s-=1
t-=1

inf = float('inf')
d = [[inf, inf, inf] for i in range(n)]
d[s][0]=0

q = queue.Queue()
for i in range(len(a[s])):
    q.put(a[s][i])
    d[a[s][i]][1]=1


while not q.empty():
    p = q.get()
    for i in range(len(a[p])):
        r = a[p][i]
        c = []
        if d[r][0]==inf:
            c.append(0)
        if d[r][1]==inf:
            c.append(1)
        if d[r][2]==inf:
            c.append(2)
        if not c:
            continue

        flag = False
        for j in range(len(c)):
            if c[j]==0:
                if d[p][2]!=inf:
                    break
            elif c[j]==1:
                if d[p][0]!=inf:
                    break
            elif c[j]==2:
                if d[p][1]!=inf:
                    break
            if j==len(c)-1:
                flag=True
        if flag:
            continue

        q.put(r)
        if d[r][0]==inf:
            d[r][0]=d[p][2]+1
        if d[r][1]==inf:
            d[r][1]=d[p][0]+1
        if d[r][2]==inf:
            d[r][2]=d[p][1]+1
        if r==t and d[r][0]!=inf:
            print(d[r][0]//3)
            exit()
print(-1)






### FIXED CODE ###

import queue

n,m = map(int, input().split())
a = [[] for i in range(n)]

for i in range(m):
    u,v = map(int, input().split())
    u-=1
    v-=1
    a[u].append(v)

s,t = map(int, input().split())
s-=1
t-=1

inf = float('inf')
d = [[inf, inf, inf] for i in range(n)]
d[s][0]=0

q = queue.Queue()
for i in range(len(a[s])):
    q.put(a[s][i])
    d[a[s][i]][1]=1


while not q.empty():
    p = q.get()
    for i in range(len(a[p])):
        r = a[p][i]
        c = []
        if d[r][0]==inf:
            c.append(0)
        if d[r][1]==inf:
            c.append(1)
        if d[r][2]==inf:
            c.append(2)
        if not c:
            continue

        flag = False
        for j in range(len(c)):
            if c[j]==0:
                if d[p][2]!=inf:
                    break
            elif c[j]==1:
                if d[p][0]!=inf:
                    break
            elif c[j]==2:
                if d[p][1]!=inf:
                    break
            if j==len(c)-1:
                flag=True
        if flag:
            continue

        q.put(r)
        for j in range(len(c)):
            if c[j]==0:
                d[r][0] = d[p][2] + 1
            elif c[j]==1:
                d[r][1] = d[p][0] + 1
            elif c[j]==2:
                d[r][2] = d[p][1] + 1

        if r==t and d[r][0]!=inf:
            print(d[r][0]//3)
            exit()
print(-1)
### BUGGY CODE ###

#/usr/bin/python

def solve():
    n = int(input())
    a = sorted(map(int, input().split()), reverse=True)
    a2 = sum([[i, i] for i in a], []) # flatten
    a2[0] = 0
    return sum(a2[:n])

print(solve())


### FIXED CODE ###

#/usr/bin/python

def solve():
    n = int(input())
    a = sorted(map(int, input().split()), reverse=True)
    a2 = [0] * len(a) * 2
    for i in range(len(a2)):
        a2[i] = a[i//2]
        if i >= n:
            break
    a2[0] = 0
    return sum(a2[:n])

print(solve())
### BUGGY CODE ###

def main():
  n=int(input())
  s=input()
  dp=[[0]*(n+1) for i in range(n+1)]
  for i in reversed(range(n)):
    for j in reversed(range(i+1,n)):
      if s[i]==s[j]:
        dp[i][j]=dp[i+1][j+1]+1
  
  ans=0
  for i in range(n):
    for j in range(i+1,n):
      ans=max(ans,min(j-i,dp[i][j]))
  print(ans)
        

if __name__=='__main__':
  main()

### FIXED CODE ###

def main():
  n=int(input())
  s=input()
  dp=[[0]*(n+1) for i in range(n+1)]
  for i in range(n-1,-1,-1):
    for j in range(n-1,i,-1):
      if s[i]==s[j]:
        dp[i][j]=dp[i+1][j+1]+1
  #for i in dp:
  #  print(i)
  
  ans=0
  for i in range(n-1):
    for j in range(i+1,n):
      ans=max(ans,min(j-i,dp[i][j]))
  print(ans)      
        

if __name__=='__main__':
  main()
### BUGGY CODE ###

N = int(input())
AA = list(map(int, input().split()))

l = []
for i in range(N):
    A = AA.copy()
    A.pop(i)
    minA = min(A)
    while len(A) > 1:
        minA = min(A)
        tempA = []
        tempA.append(minA)
        for a in A:
            mod = a % minA
            if mod > 0:
                tempA.append(mod)
        A = tempA
    l.append(A[0])
print(max(l))

### FIXED CODE ###

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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(gcd(gcd_l[i], A[i]))
    gcd_r.append(gcd(gcd_r[i], A[-(i+1)]))

gcds = []
for i in range(N):
    gcds.append(gcd(gcd_l[i], gcd_r[-(i+2)]))
ans = max(gcds)
print(ans)
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()

def hoge(s):
    l, r = map(int, input().split())
    print(s[l-1:r].count("AC"))

if __name__ == "__main__":
    for i in range(q):
        hoge(s)

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

nums = [0] * N
count = 0
for i in range(len(S)-1):
    nums[i] = count
    if S[i] == "A" and S[i+1] == "C":
        count += 1
nums[-1] = count

for _ in range(Q):
    l,r = map(int, input().split())
    print(nums[r-1] - nums[l-1])
### BUGGY CODE ###

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

b = []
for i in range(n):
    r = 0
    for j in range(i,n):
        r += a[j]
        b.append(r)


n2 = n*(n+1)//2

res = 0
for i in range(41):
    p = res + 2**(40-i)
    
    c = 0
    for j in range(n2):
        if p == p&b[j]:
            c+=1
    
    if c >= k:
        res = p

print(res)

### FIXED CODE ###

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

b = []
for i in range(n):
    r = 0
    for j in range(i,n):
        r += a[j]
        b.append(r)


n2 = n*(n+1)//2

res = 0
for i in range(41):
    p = res + 2**(40-i)
    
    c = 0
    for j in range(n2):
        if p == p&b[j]:
            c+=1
    
    if c >= k:
        res = p

print(res)
### BUGGY CODE ###

s = list(str(input()))
t = list(str(input()))
for i in range(len(s)):
    if s[i] != t[i]:
        c1 = s[i]
        c2 = t[i]
        for j in range(len(s)):
            if s[j] == c1:
                s[j] = c2
            else:
                if s[j] == c2:
                    s[j] = c1
if s == t:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = str(input())
t = str(input())

import collections
s_count = collections.Counter(s)
t_count = collections.Counter(t)

if sorted(s_count.values()) == sorted(t_count.values()):
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

A, B, N = map(int, input().split())

mx = 0
for i in range(N+1):
    mx = max(mx, (A*i)//B-A*(i//B))
    
print(mx)

### FIXED CODE ###

A, B, N = map(int, input().split())

if N < B:
    print((A * N)//B)
else:
    x = (N // B) * B - 1
    print((A*x)//B - A*(x//B))
### BUGGY CODE ###

def main():
    N, K = map(int, input().split())
    l = list(map(int, input().split()))
    
    for i in range(N - K):
        p = 0
        n = 0
        for j in range(K):
            p = p + l[j+i]
            n = n + l[j+i+1]
        if p < n:
            print('Yes')
        else:
            print('No') 
main()



### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    l = list(map(int, input().split()))
    for i in range(K, N):
        if l[i] > l[i-K]:
            print('Yes')
        else:
            print('No')
main()
### BUGGY CODE ###

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

ans = a[0]
for i in range(1,n):
    ans = ans * a[i]
    
if ans > 10 ** 18:
    print(-1)
else:
    print(ans)  

### FIXED CODE ###

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

ans = a[0]

if 0 in a:
    print(0)
else:
    for i in range(1,n):
        ans = ans * a[i]
        if ans > 10 ** 18:
            break  
    if ans > 10 ** 18:
        print(-1)
    else:
        print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
from bisect import bisect_right

def main():
    N = int(input())
    L = sorted(list(map(int, input().split())))
    ans = 0

    for i in range(N-1):
        for j in range(i+1,N):
            diff = L[j] - L[i]
            index = bisect_right(L[:i],diff)
            ans += i-index
            # print(i,j,ans)
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from bisect import bisect_right

def main():
    N = int(input())
    L = sorted(list(map(int, input().split())))
    ans = 0

    for i in range(N-1):
        for j in range(i+1,N):
            diff = L[j] - L[i]
            index = bisect_right(L[:i],diff)
            ans += i-index
            # print(i,j,ans)
    print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n,k=map(int,input().split())
ab=[[] for i in range(n+1)]
for i in range(n-1):
  a,b=map(int,input().split())
  ab[a]+=[[b,a]]
  ab[b]+=[[a,b]]
x=k
c=[]
c+=ab[1]
d=[0]*(n+1)
d[1]=1
while c:
  y,z=c.pop()
  for i in ab[y]:
    if i[0]!=z:
      c+=[i]
  x=(x*max(0,k-1-sum([d[i[0]] for i in ab[z]])))%(10**9+7)
  d[y]=1
print(x)

### FIXED CODE ###

n,k=map(int,input().split())
ab=[[] for i in range(n+1)]
for i in range(n-1):
  a,b=map(int,input().split())
  ab[a]+=[[b,a]]
  ab[b]+=[[a,b]]
x=k
c=[]+ab[1]
d=[0]*(n+1)
while c:
  y,z=c.pop()
  c+=[i for i in ab[y] if i[0]!=z]
  x=(x*max(0,k-1-d[z]))%(10**9+7)
  d[z]+=1
  d[y]=1
print(x)
### BUGGY CODE ###

#coding: utf-8
import sys
def input():
    return sys.stdin.readline()[:-1]
"""
N人が1列に並んでおり、前からi番目の人の身長は A_iです。
それぞれの人の足元に、高さが0以上の踏み台を設置し、全ての人が次の条件を満たすようにしたいです。
条件：踏み台を込めて身長を比較したとき、自分より前に、自分より背の高い人が存在しない
この条件を満たす時の、踏み台の高さの合計の最小値を求めてください。
"""
N = int(input())
A = list(map(int, input().split()))
out = 0
for x, a in enumerate(A):
    if x==0:
        continue
    out += max(0, max(A[:x])-a)
print(out)

### FIXED CODE ###

#coding: utf-8
import sys
def input():
    return sys.stdin.readline()[:-1]
"""
N人が1列に並んでおり、前からi番目の人の身長は A_iです。
それぞれの人の足元に、高さが0以上の踏み台を設置し、全ての人が次の条件を満たすようにしたいです。
条件：踏み台を込めて身長を比較したとき、自分より前に、自分より背の高い人が存在しない
この条件を満たす時の、踏み台の高さの合計の最小値を求めてください。
"""
N = int(input())
A = list(map(int, input().split()))
out = 0
# for x, a in enumerate(A):
#     if x==0:
#         continue
#     out += max(0, max(A[:x])-a)
vmax = 0
for a in A:
    vmax = max(vmax, a)
    out += vmax - a
print(out)
### BUGGY CODE ###

n = int(input())
s = []
c = []
s_dash = []
ans = 0

for _ in range(n):
	s.append(input())

for i in range(n):
	c.clear()
	for j in s[i]:
		c.append(j)

	c.sort()
	c_str = ''
	for j in range(10):
		c_str += c[j]

	s_dash.append(c_str)

for i in range(n):
	for j in range(i+1,n):
		if s_dash[i] == s_dash[j]:
			ans += 1

print(ans)


### FIXED CODE ###

def cmb(n, r):
	if n < r: return 0
	if r == 0: return 1
	if r == 1: return n
	if n - r < r: r = n - r

	numerator = [n - r + k + 1 for k in range(r)]
	denominator = [k + 1 for k in range(r)]

	for p in range(2,r+1):
		pivot = denominator[p - 1]
		if pivot > 1:
			offset = (n - r) % p
			for k in range(p-1,r,p):
				numerator[k - offset] /= pivot
				denominator[k] /= pivot

	result = 1
	for k in range(r):
		if numerator[k] > 1:
			result *= int(numerator[k])

	return result

n = int(input())
s = []
for _ in range(n):
	tmp = list(input())
	tmp.sort()
	s.append(tmp)

s.sort()

count = 1
ans = 0
for i in range(n-1):
	if s[i] == s[i+1]:
		count += 1
	else:
		ans += cmb(count,2)
		count = 1

if count != 1:
	ans += cmb(count,2)

print(ans)
### BUGGY CODE ###

from itertools import permutations

N, M, R = map(int, input().split())
r = list(map(int, input().split()))
for i in range(R):
  r[i] -= 1

d = [[10000000000]*N for _ in range(N)]
for i in range(N):
  d[i][i] = 0

for i in range(M):
  A, B, C = map(int, input().split())
  d[A-1][B-1] = C
  d[B-1][A-1] = C
  
for k in range(N):
  for i in range(N):
    for j in range(N):
      d[i][j] = min(d[i][j], d[i][k]+d[k][j])
      
perms = permutations(r, R)
ans = 10000000000
for perm in perms:
  now = 0
  for i in range(R-1):
    now += d[perm[i]][perm[i+1]]
  ans = min(ans, now)
  
print(ans)


### FIXED CODE ###

from itertools import permutations

N, M, R = map(int, input().split())
r = list(map(int, input().split()))
for i in range(R):
  r[i] -= 1

d = [[10000000000]*N for _ in range(N)]
for i in range(N):
  d[i][i] = 0

for i in range(M):
  A, B, C = map(int, input().split())
  d[A-1][B-1] = C
  d[B-1][A-1] = C
  
for k in range(N):
  for i in range(N):
    for j in range(N):
      d[i][j] = min(d[i][j], d[i][k]+d[k][j])
      
perms = permutations(r, R)
ans = 10000000000
for perm in perms:
  now = 0
  for i in range(R-1):
    now += d[perm[i]][perm[i+1]]
  ans = min(ans, now)
  
print(ans)
### BUGGY CODE ###

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

@lru_cache(maxsize=None)
def judge(n):
    if n < 0:
        return 1

    ret = 0
    for x in a:
        if judge(n-x) == 0:
            ret = 1
    return ret

ans = judge(K)
if ans:
    print("First")
else:
    print("Second")


### FIXED CODE ###

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")
### BUGGY CODE ###

s = input()
K = int(input())
A =[]
b = len(s)
for i in range(b+1):
  for j in range(b+1):
    if j > i:
      if s[i:j] in A:
        continue
      else:
        A.append(s[i:j])
B = A
if K == 1:
  ans = min(B)
if K == 2:
  B.remove(min(B))
  ans = (min(B))
if K == 3:
  B.remove(min(B))
  B.remove(min(B))
  ans = (min(B))
if K == 4:
  B.remove(min(B))
  B.remove(min(B))
  B.remove(min(B))
  ans = (min(B))
if K == 5:
  B.remove(min(B))
  B.remove(min(B))
  B.remove(min(B))
  B.remove(min(B))
  ans = (min(B))
print(ans)

### FIXED CODE ###

s = input()
K = int(input())
A =[]
b = len(s)
for i in range(b+1):
      if i+1 < b+1:
        A.append(s[i:i+1])
      if i+2 < b+1:
        A.append(s[i:i+2])
      if i+3 < b+1:
        A.append(s[i:i+3])
      if i+4 < b+1:
        A.append(s[i:i+4])
      if i+5 < b+1:
        A.append(s[i:i+5])
B = set(A)
B = list(B)
B = sorted(B)
print(B[K-1])
### BUGGY CODE ###

n = int(input())
ls = list(map(int,input().split()))
ls.sort()
p = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if ls[k] < ls[i] + ls[j]:
                p += 1
print(p)


### FIXED CODE ###

n = int(input())
ls = list(map(int,input().split()))
ls.sort()
p = 0
def is_ok(arg,l):
    return ls[arg] < l
def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        l = ls[i] + ls[j]
        if is_ok(mid,l):
            ok = mid
        else:
            ng = mid
    return ok
for i in range(n-2):
    for j in range(i+1,n-1):
        ng = n
        ok = j
        m = meguru_bisect(ng, ok)
        p += m-j 
print(p)