Harryxun/stf_run huggingface dataset:
n,k=map(int,input().split())
a=list(map(int,input().split()))
tmax=max(a)
tmin=0
t=(tmax+tmin)//2
import math
ans=tmax
if k==0:
  print(tmax)
else:
  while True:
    s=0
    for i in range(n):
      s=s+math.ceil(a[i]/t)-1
    if k>=s:
      ans=min(math.ceil(t),math.ceil(ans))
      tmax=t
      t=(tmin+t)//2
    else:
      tmin=t
      t=(t+tmax)//2
    if tmax-tmin<0.01:
      break
  print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
tmax=max(a)
tmin=0
import math
ans=tmax
if k==0:
  print(tmax)
else:
  while True:
    t=(tmax+tmin)//2
    if abs(tmax-tmin)<=1:
      break
    s=0
    for i in range(n):
      s=s+math.ceil(a[i]/t)-1
    if k>=s:
      ans=min(math.ceil(t),ans)
      tmax=t
    else:
      tmin=t
  print(ans)
S = input()
Q = int(input())
for i in range(Q):
  Query_i = list(map(str, input().split()))
  if Query_i[0]=='1':
    S = S[::-1]
  elif Query_i[1] = '1':
    S = Query_i[2] + S
  else:
    S = S + Query_i[2]
print(S)

### FIXED CODE ###

from collections import deque

S = deque(input())
Q = int(input())
flip = False # False: left side is the head
for i in range(Q):
  Query_i = list(map(str, input().split()))
  if Query_i[0]=='1':
    flip = not flip
  elif Query_i[1] == '1' and not flip:
    S.appendleft(Query_i[2])
  elif Query_i[1] == '1' and flip:
    S.append(Query_i[2])
  elif Query_i[1] == '2' and not flip:
    S.append(Query_i[2])
  elif Query_i[1] == '2' and flip:
    S.appendleft(Query_i[2])
if flip:
  S.reverse()
print(''.join(S))
from sys import stdin

n, m = (int(n) for n in stdin.readline().rstrip().split())

a = []
for cnt in range(n):
    a.append([int(n) for n in stdin.readline().rstrip().split()])

b = []
for cnt in range(m):
    b.append([int(n) for n in stdin.readline().rstrip().split()])


from numpy import dot

c = dot(a, b)

for cn in c:
    print(int(cn))



### FIXED CODE ###

def my_dot(lhs, rhs):
    return [sum(a[i][j] * b[j][0] for j in range(len(rhs))) for i in range(len(lhs))]


if __name__ == '__main__':
    from sys import stdin

    n, m = (int(n) for n in stdin.readline().rstrip().split())

    a = []
    for cnt in range(n):
        a.append([int(n) for n in stdin.readline().rstrip().split()])

    b = []
    for cnt in range(m):
        b.append([int(n) for n in stdin.readline().rstrip().split()])

    c = my_dot(a, b)

    for cn in c:
        print(int(cn))
n = int(input())
s = input()
cnt=0
for i in range(n):
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
        cnt+=1
print(cnt)

### FIXED CODE ###

n = int(input())
s = input()
print(s.count('ABC'))
a,b=map(int,input().split())#整数を複数の変数に格納

for i in range
if a > b:
    print(str(b)*a)
else:
    print(str(a)*b)

### FIXED CODE ###

a,b=map(int,input().split())#整数を複数の変数に格納

if a > b:
    print(str(b)*a)
elif a < b:
    print(str(a)*b)
else:
    print(str(a)*a)
n, k, q = (int(i) for i in input().split())
a = [k]*n
d = [0] + [a[i]-a[i-1] for i in  range(1,n)]+[0]
for i in range(q):
  x = int(input())-1
  d[0]-=1
  d[x]+=1
  d[x+1]-=1
  d[n]+=1
a[0]+=d[0]
for i in range(1,n): a[i] = a[i-1]+d[i]
for i in range(n): printf("Yes" if a[i]>0 else "No")

### FIXED CODE ###

n,k,q = (int(i) for i in input().split())
a = [k]*n
d = [0]*(n+1)
for i in range(q):
	x = int(input())-1
	d[0]-=1
	d[x]+=1
	d[x+1]-=1
a[0] += d[0]
for i in range(1,n):
	a[i] = a[i-1] + d[i]
for i in range(n):
	print("Yes" if a[i]>0 else "No")
import os
import math

def main():
    l = int(input())
    if l%3 == 0:
        s = l/3
        print(s*s*s)
    else:
        s = math.floorl(l/3)
        s1 = s + 0.5
        print(s*s1*s1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

l = int(input())
print((l/3)**3)
import numpy as np
import math
import collections
import fractions
import itertools

def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))

def solve():
    n = int(input())
    cost = 0
    a, b = [0]*n, [0]*n
    for i in range(n):
        a[i], b[i] = mput()
    for i in range(n-1, -1, -1):
        mult = math.ceil(a[i]/b[i])*b[i]
        cost += mult - a[i]
        for j in range(0, i+1):
            a[j] += mult - a[i]
    print(cost)
    return 0

if __name__ == "__main__":
    solve()


### FIXED CODE ###

import numpy as np
import math
import collections
import fractions
import itertools

def iput(): return int(input())
def mput(): return map(int, input().split())
def lput(): return list(map(int, input().split()))

def solve():
    n = int(input())
    cost = 0
    a, b = [0]*n, [0]*n
    for i in range(n):
        a[i], b[i] = mput()
    inc = 0
    for i in range(n-1, -1, -1):
        a[i] += inc
        mult = math.ceil(a[i]/b[i])*b[i]
        cost += mult - a[i]
        inc += mult - a[i]
    print(cost)
    return 0

if __name__ == "__main__":
    solve()
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
input = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
N = int(input())
A = list(map(int, input().split(' ')))
Asum = [i+A[i] for i in range(N)]
Adif = [i-A[i] for i in range(N)]

ans = 0
for i in range(N):
    for j in range(i+1, N):
        if Asum[i] == Adif[j]:
            ans += 1

print(ans)


### FIXED CODE ###

from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
# read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines
input = sys.stdin.readline

start = time.time()
N = int(input())
A = list(map(int, input().split(' ')))
Asum = [i+A[i] for i in range(N)]
Adif = [i-A[i] for i in range(N)]

ans = 0
d = defaultdict(int)
for i in range(N):
    ans += d[Adif[i]]
    d[Asum[i]] += 1

print(ans)
from pattern.en import pluralize, singularize
s=input()
print(pluralize(s))

### FIXED CODE ###

s=input()
if s[-1]=='s':
    print(s+'es')
else:
    print(s+'s')
import sys

def main():
    r, g, b = map(int(), input().split())
    x = 10 * g + b
    if x%4==0:
        print('YES')
    else:
        print('NO')

main()

### FIXED CODE ###

import sys

def main():
    r, g, b = map(int, input().split())
    x = 10 * g + b
    if x%4==0:
        print('YES')
    else:
        print('NO')

main()
#55b
n = int(input())
p=1

for i in range(1,n+1):
    p = p*i

print(a%(10**9+7))

### FIXED CODE ###

#55b
n = int(input())
p=1

for i in range(1,n+1):
    p = i*p%(10**9+7)

print(p)
import sys
sys.setrecursionlimit(10**9)

N, M = map(int, input().split())
adjL = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    adjL[A-1].append(B-1)
    adjL[B-1].append(A-1)

if M % 2:
    print(-1)
    sys.exit()

anss = []
degs = [0] * N
useds = [False] * N

vNotLeafs = []
for v in range(N):
    if len(adjL[v]) == 1:
        v0 = adjL[v][0]
        anss.append(v0, v)
        degs[v0] += 1
        useds[v] = True
    else:
        vNotLeafs.append(v)
#print(vNotLeafs)

def dfs(vNow):
    if degs[vNow] % 2 == 0:
        useds[vNow] = True
    for v2 in adjL[vNow]:
        if useds[v2]: continue
        if not useds[vNow]:
            anss.append((vNow, v2))
            degs[vNow] += 1
            useds[vNow] = True
        else:
            anss.append((v2, vNow))
            degs[v2] += 1
        dfs(v2)

dfs(vNotLeafs[0])

print('\n'.join(map(lambda x: str(x[0]+1)+' '+str(x[1]+1), anss)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N, M = map(int, input().split())
adjL = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    adjL[A-1].append(B-1)
    adjL[B-1].append(A-1)

if M % 2:
    print(-1)
    sys.exit()

def makeSpanningTree(vNow, vPar):
    useds[vNow] = True
    for v2 in adjL[vNow]:
        if v2 == vPar:
            pass
        elif useds[v2]:
            if vNow < v2:
                anss.append((vNow, v2))
                outdegs[vNow] += 1
        else:
            adjL2[vNow].append(v2)
            adjL2[v2].append(vNow)
            makeSpanningTree(v2, vNow)

anss = []
adjL2 = [[] for _ in range(N)]
outdegs = [0] * N
useds = [False] * (N)
makeSpanningTree(0, -1)

def dfs(vNow, vPar):
    for v2 in adjL2[vNow]:
        if v2 != vPar:
            dfs(v2, vNow)
    if outdegs[vNow] % 2:  # 出す
        anss.append((vNow, vPar))
        outdegs[vNow] += 1
    else:  # 入れる
        anss.append((vPar, vNow))
        outdegs[vPar] += 1

dfs(0, -1)
anss.pop()

print('\n'.join(map(lambda x: str(x[0]+1)+' '+str(x[1]+1), anss)))
n,m = map(int,input().split())
g = [[] for i in range(n)]
 
for i in range(m):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    g[x].append(y)
    
dp = [-1]*n
 
def dfs(i):
    #すでに計算されているなら
    if dp[i] != -1:
        return dp[i]
    #初期は長さ0
    tmp = 0
    #iからスタートしてつながっているところにDFS
    for j in g[i]:
        #今までの距離と比較
        tmp = max(tmp, dfs(j) + 1)
    #dp[i]はiからスタートして最長距離が記録される
    #空のリストにたどり着いたらDFS終わり
    dp[i] = tmp
    return tmp
 
for i in range(n):
    dfs(i)

print(max(dp))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n,m = map(int,input().split())
g = [[] for i in range(n)]
 
for i in range(m):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    g[x].append(y)
dp = [-1]*n
 
def dfs(i):
    #すでに計算されているなら
    if dp[i] != -1:
        return dp[i]
    #初期は長さ0
    tmp = 0
    #iからスタートしてつながっているところにDFS
    for j in g[i]:
        #今までの距離と比較
        tmp = max(tmp, dfs(j) + 1)
    #dp[i]はiからスタートして最長距離が記録される
    #空のリストにたどり着いたらDFS終わり
    dp[i] = tmp
    return tmp
 
for i in range(n):
    dfs(i)

print(max(dp))
print(input().replace(s[3],'8'))

### FIXED CODE ###

s=input()
print(s.replace('2017','2018'))
import sys
sys.setrecursionlimit(10 ** 5 + 10)


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


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    l = [0]*(n+1)
    l[n] = (A[n], A[n])
    for i in reversed(range(1, n+1)):
        l[i-1] = (max(math.ceil(l[i][0]/2)+A[i-1], 1), l[i][1]+A[i-1])

    if 1 not in range(l[0][0], l[0][1]+1):
        print(-1)
    else:
        ans = [0]*(n+1)
        ans[0] = 1
        cnt = 1
        for i in range(n):
            ans[i+1] = min((ans[i]-A[i])*2, l[i+1][1])
        print(sum(ans))


resolve()

### FIXED CODE ###

import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


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


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    l = [0]*(n+1)
    l[n] = (A[n], A[n])
    for i in reversed(range(1, n+1)):
        l[i-1] = (max(math.ceil(l[i][0]/2)+A[i-1], 1), l[i][1]+A[i-1])

    if 1 not in range(l[0][0], l[0][1]+1):
        print(-1)
    else:
        ans = [0]*(n+1)
        ans[0] = 1
        cnt = 1
        for i in range(n):
            ans[i+1] = min((ans[i]-A[i])*2, l[i+1][1])
        print(sum(ans))


resolve()
N,W = map(int,input().split())
weight = []
value = []
for i in range(N):
    w,v = map(int,input().split())
    weight.append(w)
    value.append(v)
maxValue = N*1000
dp = [[float("inf") for i in range(maxValue+1)] for j in range(N+1)]
for i in range(N+1):
    dp[i][0] = 0

for i in range(1,N+1):
    for v in range(1,maxValue+1):
        dp[i][v] = dp[i-1][v]
        if value[i] > v: continue;
        dp[i][v] = min(dp[i][v],weight[i] + dp[i-1][v-value[i]])
ans = 0
for x in range(maxValue+1):
    if dp[N][x] <= W:
        ans = x
print(ans)

### FIXED CODE ###

N,W = map(int,input().split())
weight = [0]
value = [0]
for i in range(N):
    w,v = map(int,input().split())
    weight.append(w)
    value.append(v)
    
maxValue = sum(value)
INF = 10**10
dp = [[INF for i in range(maxValue+1)] for j in range(N+1)]
for i in range(N+1):
    dp[i][0] = 0
for i in range(1,N+1):
    for v in range(1,maxValue+1):
        if value[i] <= v:
            dp[i][v] = min(dp[i-1][v],weight[i] + dp[i-1][v-value[i]])
        else:
            dp[i][v] = dp[i-1][v]
ans = 0
for x in range(maxValue+1):
    if dp[N][x] <= W:
        ans = x
print(ans)
def main():
    S = input() + '.'
    count = 0
    data = []
    for i, s in enumerate(S[1:]):
        count += 1
        if s != S[i]:
            data.append(count)
            count = 0
    data.append(0)
    ans = max([min(data[i-1]+data[i], data[i]+data[i+1]) for i in range(1,len(data)-1)])
    print(ans)

main()

### FIXED CODE ###

S = list(input())
lenS = len(S)
S = S + ['.']
K = lenS
i = 0
ps = S[0]
for s in S:
    if s != ps:
        K = min(K, max(i, lenS-i))
        ps = s
    i += 1
print(K)
s=input()
n=len(s)
lst=[]
cnt=1

if n==2:
  print(1)
  
for i in range(n-2):
  if s[i]=s[i+1]:
    cnt+=1
  else:
    lst.append(cnt)
    cnt-=(cnt-1)
totl=0
if s[0]=='<':
  for j in range(len(lst)):
    if j%2==0:
      totl+=(lst[j]*(lst[j]-1))//2
      totl+=max(lst[j],lst[min(j+1,len(lst)-1)])
    else:
      totl+=(lst[j]*(lst[j]-1))//2
  print(totl)
else:
  totl+=lst[0]
  for j in range(len(lst)):
    if j%2==1:
      totl+=(lst[j]*(lst[j]-1))//2
      totl+=max(lst[j],lst[min(j+1,len(lst)-1)])
    else:
      totl+=(lst[j]*(lst[j]-1))//2
  print(totl)

      
      
      
      
      
  


### FIXED CODE ###

s=input()
n=len(s)
lst=[]
cnt=1

if n==2:
  print(1)
  
for i in range(n-1):
  if s[i]==s[i+1]:
    cnt+=1
  else:
    lst.append(cnt)
    cnt-=(cnt-1)

if s[n-2]!=s[n-1]:
  lst.append(1)
else:
  lst.append(cnt)
    
totl=0
l=len(lst)
if s[0]=='<':
  for j in range(l):
    if j%2==0:
      totl+=(lst[j]*(lst[j]-1))//2
      totl+=max(lst[j],lst[min(j+1,l-1)])
    else:
      totl+=(lst[j]*(lst[j]-1))//2
  print(totl)
else:
  totl+=lst[0]
  for j in range(len(lst)):
    if j%2==1:
      totl+=(lst[j]*(lst[j]-1))//2
      totl+=max(lst[j],lst[min(j+1,l-1)])
    else:
      totl+=(lst[j]*(lst[j]-1))//2
  print(totl)
def main:
  print(1000)

### FIXED CODE ###

import sys

a = []
for line in sys.stdin:
    a.append(int(line))
print(a[1] * 2 - a[0])
#include<bits/stdc++.h>
using namespace std;

using ll=long long; 

void solve(){
	string a,b;
	cin>>a>>b;
	if(a.size()!=b.size()){
		if(a.size()>b.size()){
			cout<<"GREATER"<<endl;
		}
		else if (a.size()<b.size()){
			cout<<"LESS"<<endl;
		}
		else{
			cout<<"EQUAL"<<endl;
		}
	}
	else{
		for(int i=0; i<a.size(); i++){
			if(a[i]>b[i]){
				cout<<"GREATER"<<endl;
				return;
			}
			else if(a[i]<b[i]){
				cout<<"LESS"<<endl;
				return;
			}
		}
		cout<<"EQUAL"<<endl;
		return;
	}

}

signed main(){
	//while(1)
	solve();
}

### FIXED CODE ###

a=int(input())
b=int(input())
if a>b:
	print("GREATER")
elif a<b:
	print("LESS")
else:
	print("EQUAL")
a,b,c = map(int, input().split())

A_B = (a+b)
A_C = (a+c)
B_C = (b+c)

if (A_B == c) or (A_C == b) or (B_C = a):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c = map(int, input().split())

A_B = (a+b)
A_C = (a+c)
B_C = (b+c)

if (A_B == c):
    print("Yes")
elif (A_C == b):
    print("Yes")
elif (B_C == a ):
    print("Yes")
else:
    print("No")
a=map(int,input().split())
if a[0]<a[1]:
    print("a < b")
elif a[0]>a[1]:
    print("a > b")
else:
    print("a == b")


### FIXED CODE ###

a,b=map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")
from sys import stdin, stdout



def solve():
    n = int(input())
    A = [int(i) for i in stdin.readline().split()]
    dp = [[i,0] for i in A]
    t = [[0,0] for _ in range(len(A))]
    for i in range(1, len(A)):
        for j in range(i, len(A)):
            l = A[j-i] + dp[j][1]
            r = A[j] + dp[j-1][1]
            if l > r:
                t[j][0] = l
                t[j][1] = dp[j][0]
            else:
                t[j][0] = r
                t[j][1] = dp[j-1][0]
        dp = t.copy()
        t = [[0,0] for _ in range(len(A))]
    return dp[-1][0] - dp[-1][1]


print(solve())

### FIXED CODE ###

from sys import stdin, stdout


def solve():
    n = int(input())
    A = [int(i) for i in stdin.readline().split()]
    dp = [[i,0] for i in A]
    t = [[0,0] for _ in range(len(A))]
    for i in range(1, len(A)):
        for j in range(i, len(A)):
            l = A[j-i] + dp[j][1]
            r = A[j] + dp[j-1][1]
            if l > r:
                t[j][0] = l
                t[j][1] = dp[j][0]
            else:
                t[j][0] = r
                t[j][1] = dp[j-1][0]
        dp = t
        t = [[0,0] for _ in range(len(A))]
    return dp[-1][0] - dp[-1][1]


print(solve())
from itertools import takewhile, dropwhile
pn, tmp = [], [i for i in range(2, 50000)]
while tmp[0] < 224:
    v = tmp.pop(0)
    pn.append(v)
    tmp = list(filter(lambda x: x%v!=0, tmp))
for t in tmp: pn.append(t)
while True:
    try:
        n = int(input())
    except:
        break
    print(list(takewhile(lambda x: x<n, pn))[-1], list(dropwhile(lambda x: x<=n, pn))[0])

### FIXED CODE ###

primes = [0, 0] + [1]*50020
for i in range(2, 226):
    if primes[i]:
        for j in range(i*i, 50021, i):
            primes[j] = 0

while True:
    try:
        n = int(input())
    except:
        break
    print(n-primes[n-1::-1].index(1)-1, n+primes[n+1:].index(1)+1)
import itertools

DIM = int(input())
args = [int(input()) for a in range(DIM)]
temp = list(map(lambda x:x%10, args))
if sum(temp) == 0:
    exit(0)
i = DIM
while(i>0):
    comb = list(itertools.combinations(args, i))
    combMax = list(map(sum, comb))
    print(comb)
    print(combMax)
    for c in sorted(combMax, reverse=True):
        if c%10==0:
            continue
        else:
            exit(c)
    i = i -1
print(0)
exit()

### FIXED CODE ###

import itertools

DIM = int(input())
args = [int(input()) for a in range(DIM)]
temp = list(map(lambda x:x%10, args))
if sum(temp) == 0:
    print(0)
    exit()
i = DIM
while(i>0):
    comb = list(itertools.combinations(args, i))
    combMax = list(map(sum, comb))
    for c in sorted(combMax, reverse=True):
        if c%10==0:
            continue
        else:
            print(c)
            exit()
    i = i -1
print(0)
exit()
n,k = map(int,input().split())
s = input()
s[k-1] = s[k-1].lower()
print(s)

### FIXED CODE ###

n,k = map(int,input().split())
s = input()
ret=""
for i in range(n):
  if i != k-1:
    ret +=s[i]
  else:
    ret+=s[i].lower()

print(ret)
S = input()
if S == Sunny:
  print("Cloudy")
elif S ==  Cloudy:
  print("Rainy")
else:
  print("Sunny")

### FIXED CODE ###

S = input()
if S == "Sunny":
  print("Cloudy")
elif S ==  "Cloudy":
  print("Rainy")
else:
  print("Sunny")
import numpy as np
def main():
    N, W = map(int, input().split())
    #dp[v] vとなる最小のＷ
    dp = np.full(10**5+1, 10**9+1, dtype=np.int64)
    for _ in range(N):
        w,v = map(int, input().split())
        for val in range(10**5, 1, -1):
            if val - v < 1:
                break
            dp[val] = min(dp[val], dp[val - v] + w)
        if dp[v] > w:
            dp[v] = w
    print(max(np.where(dp <= W)[0]))
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N, W = map(int, input().split())
    #dp[v] vとなる最小のＷ
    dp = [10**9+1 for _ in range(10**5+1)]
    for _ in range(N):
        w,v = map(int, input().split())
        for val in range(10**5, 1, -1):
            if val - v < 1:
                break
            dp[val] = min(dp[val], dp[val - v] + w)
        if dp[v] > w:
            dp[v] = w
    ans = 0
    for v, w in enumerate(dp):
        if w <= W:
            ans = max(ans, v)
    print(ans)
if __name__ == '__main__':
    main()
S = input()
 h = S / 3600
 m = (S % 3600) / 60
 s = (S % 3600) % 60)
 print(str(int(h)) + ':' + str(int(m)) + ':' + str(s))


### FIXED CODE ###

S = input()
i = int(S)
h = i / 3600
m = (i % 3600) / 60
s = (i % 3600) % 60
print(str(int(h)) + ':' + str(int(m)) + ':' + str(s))
from math import gcd
#from fractions import gcd
from functools import reduce

def lcm(a,b):
    return a * b // gcd(a,b)
def ls_lcm(A):
    return reduce(lcm ,A)
def ls_gcd(A):
    return reduce (gcd, A)

N, M = map(int, input().split())
A = list(map(int, input().split()))
half = ls_lcm(A) // 2
#print (((M // half) + 1) // 2)
print ((M + half) // (2*half))

### FIXED CODE ###

#from math import gcd
from fractions import gcd
from functools import reduce

def lcm(a,b):
    return a * b // gcd(a,b)
def ls_lcm(A):
    return reduce(lcm ,A)
def ls_gcd(A):
    return reduce (gcd, A)

def check_two(A):
    old = None
    for n in A:
        cnt = 0
        while(n & 1 == 0):
            cnt += 1
            n = n >> 1
        if old is None:
            old = cnt
        else:
            if old!=cnt:
                return False
    return True

N, M = map(int, input().split())
A = list(map(int, input().split()))
if not check_two(A):
    print (0)
    exit()
A = [a//2 for a in A]
half = ls_lcm(A)
print ((M + half) // (2*half))
n = input()
 
INF = 10000000
 
color = [0 for i in xrange(n)]
M = [[INF for i in xrange(n)] for i in xrange(n)]
d = [INF for i in xrange(n)]
p = [-1 for i in xrange(n)]
 
def m_s_t():
  d[0] = 0
 
while True:
  cost = INF
  for i in xrange(n):
    if color[i] != 2 and d[i] < cost:
      cost = d[i]
      u = i
 
  if cost == INF:
    break
     
  color[u] = 2
 
  for v in xrange(n):
      if color[v] != 2 and M[u][v] != INF and M[u][v] < d[v]:
         d[v] = M[u][v]
         p[v] = u
         color[v] = 1
 
  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]]
  return sum
 
for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] != -1:
     M[i][j] = G[j]
 
print m_s_t()

### FIXED CODE ###

n = input()
 
inf = 10000000
 
color = [0 for i in xrange(n)]
M = [[inf for i in xrange(n)] for i in xrange(n)]
d = [inf for i in xrange(n)]
p = [-1 for i in xrange(n)]
 
def mst():
  d[0] = 0
 
  while True:
    cost = inf
    for i in xrange(n):
      if color[i] != 2 and d[i] < cost:
        cost = d[i]
        u = i
 
    if cost == inf:
      break
     
    color[u] = 2
 
    for v in xrange(n):
      if color[v] != 2 and M[u][v] != inf and M[u][v] < d[v]:
        d[v] = M[u][v]
        p[v] = u
        color[v] = 1
 
  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]]
  return sum
 
for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] != -1:
     M[i][j] = G[j]
 
print mst()
n,Ma,Mb=map(int,input().split())
inf=float("inf")
dp=[[[inf]*401 for _ in range(401)] for _ in range(n+1)]
dp[0][0][0]=0

l=[tuple(map(int,input().split())) for _ in range(n)]

for i in range(1,n+1):
    for j in range(401):
        for k in range(401):
            a,b,c=l[i-1]
            dp[i][j][k]=min(dp[i][j][k],dp[i-1][j][k])
            if j-a>=0 and k-b>=0:
                dp[i][j][k]=min(dp[i][j][k],dp[i-1][j-a][k-b]+c)

ans=inf
for i in range(1,1+max(400//Ma,400//Mb)):
    ans=min(ans,dp[n][Ma*i][Mb*i])

print(ans if ans!=inf else -1)

### FIXED CODE ###

nmax,abmax=40,10
n,ma,mb=map(int,input().split())
a,b,c=[None]*n,[None]*n,[None]*n
inf=float("inf")
for i in range(n):
  a[i],b[i],c[i]=map(int, input().split())
dp = [[[inf for _ in range(nmax*abmax+1)] for _ in range(nmax*abmax+1)] for _ in range(nmax+1)]
dp[0][0][0]=0
for i in range(n):
  for ca in range(nmax*abmax+1):
    for cb in range(nmax*abmax+1):
      if dp[i][ca][cb]==inf:continue
      dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb])
      dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i])

ans=inf
for ca in range(1,nmax*abmax+1):
  for cb in range(1,nmax*abmax+1):
    if ca*mb==cb*ma:ans=min(ans,dp[n][ca][cb])
if ans==inf:
  print(-1)
else:
  print(ans)
a = input()
b = input()

print(6-a-b)


### FIXED CODE ###

a = int(input())
b = int(input())

print(6-a-b)
N,W=map(int,input().split())
C=[0]*-~W
for _ in[0]*N:
 v,w=map(int,input().split())
 for i in range(W,w-1,-1):
  t=v+C[i-w]
  if t>C[i]:C[j]=t
print(C[W])


### FIXED CODE ###

import sys
def s():
 W=int(input().split()[1])
 C=[0]*-~W
 for e in sys.stdin:
  v,w=map(int,e.split())
  for i in range(W,w-1,-1):
   t=v+C[i-w]
   if t>C[i]:C[i]=t
 print(C[W])
s()