peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
k,n=map(int,input().split())
a=list(map(int,input().split()))
dis=[]

for i in range(len(a)-1):
  dis.append(a[i+1]-a[i])

dis.append(a[0]+k-a[n-1])
  
print(str(k-max(dis)))
# Judge status: Accepted
n,a,b=map(int,input().split())
mod=10**9+7
bunbo=1
bunshi=1
for i in range(1,max(a+1, b+1)):
    bunbo*=i
    bunshi*=n-i+1
    bunshi%=mod
    bunbo%=mod
    if i==a:
        comba=bunshi*(pow(bunbo,mod-2,mod))
    if i==b:
        combb=bunshi*(pow(bunbo,mod-2,mod))
print((2**n-1-comba-combb)%mod)
# Judge status: Accepted
N,L=map(int,input().split())
l=[L+i-1 for i in range(1,N+1)]
MIN=l[0]
for i in range(N):
    if abs(MIN)>abs(l[i]):
        MIN=l[i]
print(sum(l)-MIN)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
k = [0]*n
for i in range(len(l)):
    c = l[i]
    k[c-1] = k[c-1]+1
for j in range(len(k)):
    print(k[j])
# Judge status: Accepted
a,b,c = map(int,input().split())
k = int(input())

for i in range(k):
    if b<=a:
        b*=2
    else:
        c*=2

if b>a and c>b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read


#n,m = [int(i) for i in read().split()]

s = input()

n = len(s)
t = s[:(n-1)//2]
u = s[(n-1)//2+1:]

if s==s[::-1] and t==t[::-1] and u==u[::-1]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())

dp = [[0 for _ in range(3)] for _ in range(n)]

a, b, c = map(int, input().split())
dp[0][0] = a
dp[0][1] = b
dp[0][2] = c

for i in range(1, n):
    abc = [int(x) for x in input().split()]
    
    for j in range(len(abc)):
        dp[i][j] = max(dp[i - 1][(j + 1) % 3] + abc[j], dp[i - 1][(j + 2) % 3] + abc[j])

print(max(dp[n - 1]))
# Judge status: Accepted
n = int(input())
s = input()
res = n
w = 0
e = 0
for i in range(n):
    if s[i] == "W":
        w += 1
    else:
        e += 1

l_w = 0
l_e = 0
for i in range(n):
    if i == n - 1 and s[i] == "E":
        l_e += 1
    tmp = l_w + (e - l_e)
    res = min(tmp, res)
    if s[i] == "W":
        l_w += 1
    else:
        l_e += 1
print(res)
# Judge status: Accepted
N = int(input())

# dp[i] := i円引き出すのに必要な最小操作回数
dp = [float('inf')] * (N + 1)
dp[0] = 0
operates = sorted([1, 6, 36, 216, 1296, 7776, 46656, 9, 81, 729, 6561, 59049])
for i in range(N):
    for ope in operates:
        if i + ope > N:
            break
        dp[i + ope] = min(dp[i + ope], dp[i] + 1)

print(dp[N])
# Judge status: Accepted
n, k = map(int, input().split())
*a, = map(int, input().split())

mar = k - 1  # max replacible count

ret = 1 + (n - k + mar - 1) // mar
print(ret)

# 左端から長さKの区間をのりしろ1で貼り続ける
# 最小値1を含む要素に重なる区間から順に操作を始めれば可能
# i = a.index(1)
# mar = k - 1  # max replacible count
#
# le = (i + mar - 1) // mar  # [0,i)
# ri = (n - i - 1 + mar - 1) // mar  # [i+1,n)
#
# print(le + ri)
# Judge status: Accepted
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
import collections
import itertools
import bisect
mod = 10 ** 9 + 7
N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
count = 0
for i in range(len(L)):
    for j in range(i+1, len(L)):
        a = L[i]
        b = L[j]
        idx = insert_index = bisect.bisect_left(L, a+b)
        count += max(0, idx-j-1)


print(count)
# Judge status: Accepted
n=int(input())
s=input()
alphabet=[chr(i) for i in range(97,97+26)]
ans=0

for i in range(1,n):
    s1=s[:i]
    s2=s[i:]
    cnt=0
    for j in range(len(alphabet)):
        if s1.count(alphabet[j])>=1 and s2.count(alphabet[j])>=1:
            cnt+=1
    if cnt>ans:
        ans=cnt
print(ans)
# Judge status: Accepted

n = int(input())

s = str(n)
sl = list(s)

if sl[0]==sl[1] and sl[1] ==sl[2]:
    print("Yes")

elif sl[1]==sl[2] and sl[2] ==sl[3]:
    print("Yes")
    
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
b = list(map(int,input().split()))
a = []
a.append(b[0])

for i in range(n-2):
  tmp = max(a[i],b[i])
  a.append(tmp)
a.append(b[-1])

print(sum(a))
# Judge status: Accepted
x = int(input())

flag = True

for a in range(1, 1000):
    a5 = pow(a, 5)
    for b in range(-1000, 1000):
        b5 = pow(b, 5)
        if a5 - b5 == x and flag:
            print(a, b)
            flag = False
# Judge status: Accepted
p,q,r=map(int,input().split())
print(min(min((p+q),(p+r)),(q+r)))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
s = 0
t = 0
for i in range(n):
	k = b[i] - a[i]
	if k < 0:
		s += -k
	elif k > 0:
		t += k//2
if s <= t:
	print("Yes")
else:
	print("No")
# Judge status: Wrong Answer
A,B=map(int,input().split())
print(int(B/A)+1)
# Judge status: Accepted
n, x = map(int, input().split())
a = [ int(x) for x in input().split() ]
cnt = 1
s = 0
for aa in a:
    s += aa
    if s <= x:
        cnt += 1

print(cnt)
# Judge status: Accepted
n = int(input())
s = input()
if s[:n//2] == s[n//2:]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
# N 部屋の数 M通路の数
N, M = map(int, input().split())
field = [map(int, input().split()) for route in range(M)]
print(field)
# Judge status: Wrong Answer
n = int(input())
l = []
for i in range(n):
    w = input()
    l.append(w)
for k in range(n):
    if  l[k-1][-1] == l[k][0]:
        for j in range(i):
            if l[k] == l[j]:
                flag = 0
                break
            else:
                flag = 1
    else:
        flag = 0
if(flag == 1):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = list(input())
t = list(input())

s.sort()
t.sort(reverse=True)

if(s < t):
   print('Yes')
else:
   print('No')
# Judge status: Accepted
import bisect

N = int(input(), 10)

heads = list(sorted(map(int,input().split())))
bodies = list(map(int,input().split()))
legs = list(sorted(map(int,input().split())))


cnt = 0
for body in bodies:
    #  頭は、体より小さくなければならない
    head_cnt = bisect.bisect_left(heads, body)
    #  足は、体より大きくなければならない
    leg_cnt = N - bisect.bisect_right(legs, body)

    cnt += head_cnt * leg_cnt # 組み合わせの掛け算

print(cnt)
# Judge status: Accepted
S = input()
x = len(S)

for i in range(0, x, 2):
  y = x - 2 - i
  if S[:y//2] == S[y//2 : y]:
    
    print(len(S[:y]))
    break
# Judge status: Wrong Answer
def main():
    word = list(input())
    operation = int(input())
    cost = {}
    for i in range(26):
        cost[chr(ord("a") + i)] = ord("z") - ord("a") - i + 1
    for i in range(len(word)):
        if cost[word[i]] <= operation:
            operation -= cost[word[i]]
            word[i] = "a"
        else:
            continue
    if 0 < operation:
        word[-1] = chr(ord(word[-1]) + operation % 26)
    print("".join(word))


if __name__ == '__main__':
    main()
# Judge status: Accepted
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, A, C = map(int, readline().split())

print('Yes' if N + A >= C else 'No')
# Judge status: Accepted
N, M = map(int, input().split())
solve_problem = set()
WA = [0 for _ in range(N)]

ans = 0
penalty = 0

for i in range(M):
    p, S = input().split()
    if p in solve_problem:
        continue

    if S == 'AC':
        solve_problem.add(p)
        ans += 1
        penalty += WA[int(p)-1]
    if S == 'WA':
        WA[int(p)-1] += 1

print('{} {}'.format(ans, penalty))
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
if A >=  K:
    la = A - K
    lb = B
else:
    la = 0
    lb = A + B - K
print(la, lb)
# Judge status: Wrong Answer
n=int(input())
k=int(input())
x=int(input())
y=int(input())
sum_=0
if n-k>=0:
    sum_=k*x+(n-k)*y
else:
    sum_=k*x
print(sum_)
# Judge status: Accepted
s = list(map(int, input().split('/')))
if s[1] <= 4:
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
n = int(input())
an = list(map(int, input().split()))

an_map = [0] * n
for ai in an:
    an_map[ai - 1] += 1
for ai_map in an_map:
    print(ai_map)
# Judge status: Accepted
k, x = map(int,input().split())
if k*500 >= x:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N,K,Q=map(int,input().split())
check=[K-Q]*N
for i in range(Q):
  A=int(input())-1
  check[A]+=1
for i in range(N):
  print("Yes" if check[i]>0 else "No")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = 1e9
for p in a:
  sub = 0
  for q in a:
    sub += pow(p - q, 2)
  ans = min(ans, sub)

print(ans)
# Judge status: Wrong Answer
n, l = map(int, input().split())
pie = 0
comp = 300

for i in range(1, n+1):
    pie = pie + l + i - 1
    if abs(l + i -1) < comp:
        comp = l + i -1

print(pie - comp)
# Judge status: Accepted
s = input()
t = input()
if s==t[:len(t)-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys
myin = [x.rstrip() for x in sys.stdin.readlines()]

n = int(myin[0])
a = [int(x) for x in myin[1].split()]

cnt = [0] * (n+1)
for v in a:
    cnt[v] += 1

tmp = 0
for c in cnt:
    tmp += c * (c-1) // 2
for v in a:
    print(tmp - cnt[v] + 1)
# Judge status: Wrong Answer
word = input()
if word[-1] == "s":
  word_new =word[:-1] + "es"
  print(word_new)
else:
  print(word + "s")
# Judge status: Accepted
a,b,c = map(int,input().split())

n=set([a,b,c])

if len(n)==2:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
# coding: utf-8
n, x = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
for i in range(n-1):
    s = A[i+1] + A[i]
    if s > x:
        A[i+1] -= s - x
print(S - sum(A))
# Judge status: Wrong Answer
import math

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

a=0

for i in range(n):
    if i==0:
        a+=((c[-1][0]-c[0][0])**2+(c[-1][1]-c[0][1])**2)**(0.5)
    else:
        a+=((c[i][0]-c[i-1][0])**2+(c[i][1]-c[i-1][1])**2)**(0.5)

ans=(a/n)*(n-1)
print(ans)
# Judge status: Accepted
N = int(input())
my_array = []
for A in range (1, N):
    my_array.append(sum(map(int, str(A))) + sum(map(int, str(N - A))))
print(min(my_array))
# Judge status: Accepted
def main():
    from itertools import accumulate
    n = int(input())
    f = lambda x: 1 if x == "W" else 0
    *s, = map(f, list(input()))
    t = list(accumulate(s))
    u = t[-1]
    ans = n

    for i, (j, k) in enumerate(zip(s, t)):
        m = (k - j) + (n - 1 - i) - (u - k)
        ans = min(ans, m)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x = [int(i) for i in input().split(' ')]
ans = x.index(0)
print(ans+1)
# Judge status: Wrong Answer
N,K=map(int,input().split())
a=input()
b=list(a)

c=b[K-1]
b[K-1]='c'.lower()
print(''.join(map(str,b)))
# Judge status: Wrong Answer
N = int(input())
data = []
for _ in range(N):
    A, B = map(int, input().split())
    data.append([B, A])
data.sort()

prefix_cost = []
current_cost = 0
for i in range(N):
    current_cost += data[i][1]
    prefix_cost.append(current_cost)

for i in range(N):
    if not prefix_cost[i] <= data[i][0]:
        exit()

print('Yes')
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
X.sort()
r = None
for i in range(X[0], X[-1]+1):
    c = sum((m - i)**2 for m in X)
    if r is None or r > c:
        r = c

print(r)
# Judge status: Wrong Answer
l, r, D = input().split()
L=int(l)
R=int(r)
d=int(D)
if L%d ==0:
    a=L
else:
    while True: 
	    if L % d:
		    break
    L += 1      
    a=L 
if R%d ==0:
    b=R
else:
    while True: 
	    if R % d:
		    break
    R =R-1     
    b=R
if(b-a<1): 
    print(0)
else:            
    print(int((b-a)/d)+1)
# Judge status: Accepted
s=input()
n=0
ans=99999
for i in range(len(s)-2):
    n=int(s[i]+s[i+1]+s[i+2])
    d=abs(753-n)
    ans=min(d,ans)
print(ans)
# Judge status: Accepted
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
S = list(input())
for i in range(len(S)):
  if i % 2 == 0 and S[i] not in odd:
    print('No')
    exit()
  elif i % 2 == 1 and S[i] not in even:
    print('No')
    exit()

print('Yes')
# Judge status: Accepted
import heapq

N, M = map(int, input().split())
A = [-int(x) for x in input().split()]
heapq.heapify(A)
for m in range(M):
    a = heapq.heappop(A)
    a = int(a/2)
    heapq.heappush(A, a)
print(-sum(A))
# Judge status: Wrong Answer
# 03
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


N, M, K = LI()
if K == 0:
    print('Yes')
    exit()

for i in range(N):
    for j in range(M):
        if i*(M-j) + j*(N-i) == K:
            print('Yes')
            exit()

print('No')
# Judge status: Accepted
# まあ探索しましょうや 最低の2でも10回やりゃ1000越えるんだし
ans = 0
x = int(input())
if x == 1:
    print(1)
    exit()
for b in range(2, int(x * 0.5) + 1):
    p = 2
    while True:
        if b ** p > x:
            break
        ans = max(ans, b ** p)
        p += 1
print(ans)
# Judge status: Wrong Answer
from itertools import accumulate
N,Q = map(int,input().split())
S = str(input())
lr = [list(map(int,input().split())) for _ in range(Q)]
sl = [0]*N
for i in range(N):
  if S[i:i+2] == "AC":
    sl[i] = 1
slr = [0]+list(accumulate(sl))
ans = 0
for l,r in lr:
  l -= 1
  r -= 1
  ans = slr[r]-slr[l]
  if r < 8:
    if slr[r] == slr[r-1]:
      ans -= 1
  if slr[l] != slr[l-1]:
    ans += 1
  print(ans)
# Judge status: Wrong Answer
N,A,B = map(int, input().split())
X = N//(A+B)
Y = N%(A+B)
if Y < B:
  print(A*X+Y)
else:
  print(A*(X+1))
# Judge status: Wrong Answer
h=int(input())
w=int(input())
n=int(input())
print(min(h//n,w//n)+1)
# Judge status: Accepted
from math import factorial
n, k = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

def s(n, m=0): # m~nの総和
    global mod
    return (n * (n+1) // 2 - (n-m) * (n-m+1) // 2) % mod

sm = 0
for i in range(k, n+1):
    sm = (sm + s(n, i) - s(i-1, i-1) + 1) % mod

print((sm+1) % mod)
# Judge status: Accepted
w, a, b = map(int, input().split())
print(max(0, b - (a + w), a - (b + w)))
# Judge status: Accepted
n = int(input())
x = 1
for i in range(1,n+1):
    x=(i*x)%((10**9+7))
print(x)
# Judge status: Accepted
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
R = []
for i in range(N):
    R.append(sum(A1[:i+1])+sum(A2[i:N]))
print(max(R))
# Judge status: Wrong Answer
S = input()
from collections import Counter
C = Counter(S)
ans = len(S)
for c in S[::-1]:
    C[c] -= 1
    ans -= 1
    if all(v%2==0 for v in C.values()):
        print(ans)
        exit()
# Judge status: Wrong Answer
S=input()

ans="NO"
n=0
w=0
e=0
s=0
tate=0
yoko=0

for str in S:
  if str=="N":
    n +=1
  elif str=="E":
    e +=1
  elif str=="S":
    s +=1
  else:
    w +=1

if (n>0 and s>0) or (n==0 and s==0):
  tate=True
if (e>0 and w>0) or (e==0 and w==0):
  yoko=True
  
if tate and yoko:
  ans="Yes"
  
print(ans)
# Judge status: Accepted
import sys
s = int(input())
N = [s]
while True:
  if s % 2 == 0:
    s = s // 2
    N.append(s)
  else:
    s = 3 * s + 1
    N.append(s)
  if N.count(s) > 1:
    print(len(N))
    sys.exit()
# Judge status: Accepted
s=input()
flag=False
ans='keyence'

for i in range(len(s)):
  for j in range(i,len(s)):
    if ans==s[:i]+s[j:]:
      flag=True
      break
if flag:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n,k = map(int,input().split())
A = list(map(int,input().split()))
dp = [-1] * (n+1)
B = []
f = 1
c = 0
ans = n
bal = 0
while dp[f-1] == -1:
    dp[f-1] =c
    B.append(f)
    f = A[f-1]
    c +=1
t = B.index(f)
if k>t:
    k -= t
    B = B[B.index(f):]
    k%=len(B)
    print(B[k])
else:
    print(B[k])
# Judge status: Accepted
import heapq as hp

n,m=[int(x) for x in input().rstrip().split()]
a=[-int(x) for x in input().rstrip().split()]

hp.heapify(a)

for i in range(m):
  now=hp.heappop(a)
  hp.heappush(a,-(-now//2))
print(-sum(a))
# Judge status: Wrong Answer
import numpy
a,b = map(int,input().split())

ans=a
for i in range(b+1):
  ans = ans * (a+i)
pm = numpy.sign(ans)
if pm==0:
  print('zero')
elif pm==1:
  print('Positive')
else:
  print('Negative')
# Judge status: Wrong Answer
n = int(input())
s = list(input())
t = list(input())

ans = n * 2
if s == t:
    print(n)
else:
    for i in range(n):
        if s[-i-1:] == t[:i+1]:
            ans -= 1
        else:
            break
    print(ans)
# Judge status: Accepted
r, g, b = input().split()
num = int(r + g + b)

if num % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a,b,c = sorted(map(int,input().split()))
print(c-a)
# Judge status: Wrong Answer
N, M = map(int, input().split())
py = []
for i in range(M):
    p, y = map(int, input().split())
    py += [[i, p, y]]
py = sorted(py, key=lambda x:(x[1], x[2]))
cnt = 0
pre = py[0][1]
ans = []
for n, p, y in py:
    if pre != p:
        cnt = 1
        pre = n
    else:
        cnt += 1
        
    ans += [[n, str(p).zfill(6)+str(cnt).zfill(6)]]

ans = sorted(ans, key=lambda x:x[0])
for _, n in ans:
    print(n)
# Judge status: Accepted
n = int(input())

ans = 0
numbers = [[0] * 10 for _ in range(10)]
for i in range(1, n+1):
    ss = str(i)
    numbers[int(ss[0])][int(ss[-1])] += 1

for j in range(1, n+1):
    ss = str(j)
    ans += numbers[int(ss[-1])][int(ss[0])]

print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>b:
    print('Alice')
elif a<b:
    print('Bob')
else:
    print('Draw')
# Judge status: Wrong Answer
s=input()
for i in range(len(s)):
  print("x",end="")
  print()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = 0
for i in range(n):
	flag = True
	for j in range(i+1,n):
		if a[i]%a[j] == 0:
			flag = False
			break
	if flag:
		ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
T = [tuple(map(int, input().split())) for _ in range(N - 1)]

ans = [0] * N
for i in range(N - 1):
    for j in range(i, N - 1):
        C, S, F = T[j]
        now = ans[i] if S <= ans[i] else S
        ans[i] = now + (F - now % F) % F + C

print(*ans, sep='\n')
# Judge status: Wrong Answer
N = int(input())

for i in range(1, N+1):
    # print("i", i, "N", N)
    if N-i == 0 or N-i > i:
        print(i)
        N -= i
    else:
        continue
# Judge status: Accepted
from collections import Counter

input()
lengths = tuple(map(int, input().split(' ')))
counter = Counter(lengths)

edges = []

for length in sorted(counter.keys(), reverse=True):
    if counter[length] >= 4:
        edges.append(length)
        edges.append(length)
    elif counter[length] >= 2:
        edges.append(length)

    if len(edges) >= 2:
        break

edges.append(0)
edges.append(0)

edges.sort(reverse=True)

print(edges[0] * edges[1])
# Judge status: Wrong Answer
h,n=map(int,input().split())
A = list(map(int,input().split()))
print(sum(A))
if h >sum(A):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
abc = input().split()
d = abc[0]
e = abc[1]
f = abc[2]
g = d + e + f
g = int(g)
a = 575
b = 557
c = 755

if g == a:
    print("YES")
elif g == b:
    print("YES")
elif g == c:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N = int(input())
answer = 0
n = 1
while True:
    if n**2 <= N:
        answer = n**2
        n += 1
    else:
        break

print(answer)
# Judge status: Wrong Answer
a,b,c,x,y = map(int, input().split())

if a>= c*2 and b >= c*2:
    print(max(x,y)*c*2)

elif a>= c*2 and x >=y :
    print(x*c*2)

elif b >= c*2 and y<=x:
    print(y*c*2)

elif a + b < c*2:
    print(a*x+b*y)
    
elif a+b >= c*2:
    if x > y:
        print(y*c*2+(x-y)*a)
    else:
        print(x*c*2+(y-x)*b)
# Judge status: Accepted
s=input()
s_len=len(s)

for i in range(s_len-1):
  for j in range(i,s_len):
    if s[:i]+s[j:]=='keyence':
      print('YES')
      exit()
print('NO')
# Judge status: Wrong Answer
def resolve():
    S = list(input())

    front = int(''.join(S[:2]))
    back = int(''.join(S[2:]))

    if (0 == front or 0 == back):
        print('NA')
        return

    if (front <= 12 and back <= 12):
        print('AMBIGUOUS')
        return

    if (front > 12 and back <= 12):
        print('YYMM')
        return

    if (front <= 12 and back > 12):
        print('MMYY')
        return

    print('NA')

resolve()
# Judge status: Accepted
N,x=map(int,input().split())
a=list(map(int,input().split()))
a_sort=sorted(a,reverse=False)
tot=0
if sum(a)==x:
    print(len(a))
elif sum(a)<x:
    print(len(a)-1)
else:
    for i in range(N):
        tot+=a_sort[i]
        if tot==x:
            print(i+1)
            break
        elif tot<x:
            pass
        elif tot>x:
            print(i)
            break
# Judge status: Accepted
MOD = 10 ** 9 + 7

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
A.append(N + 1)
S = [0] * (N + 2)


S[0] = 1
i = 1

for a in A:
    while i < a:
        S[i] = (S[i - 1] + S[i - 2]) % MOD
        i += 1
    i += 1

print(S[N])
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import Counter

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

S = sum(A)
C = Counter(A)
for _ in range(int(input())):
	b, c = map(int, input().split())

	S -= C[b] * b
	S += C[b] * c
	C[c] += C[b]
	C[b] = 0

	print(S)
# Judge status: Wrong Answer
import math
n = int(input())
a = list(map(int,input().split()))

sum = [0]*(n+1)

for i in range(1,n+1):
	for k in range(1,math.floor(n/i)+1):
		j = int(k*i)
		sum[i] += a[j-1]

L = [i+1 for i in range(n) if a[i] == 1]
M=[str(a) for a in L]
M=" ".join(M)
print(len(M))
print(M)
# Judge status: Accepted
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = np.array(list(sr()), np.int8)
length = len(S)
complete = np.arange(length) & 1
r1 = (S == complete).sum()
r2 = (S != complete).sum()
answer = min(r1, r2)
print(answer)
# Judge status: Wrong Answer
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''


A, B = map(int,input().split())
ans = 0
for i in range(21):
	if ((A*(i+1))-i)>=B:
		ans = i+1 
		break
print(ans)
# Judge status: Wrong Answer
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = [inp() for _ in range(n)]
res = 0
f = False
for i,x in enumerate(a):
    if x%2:
        if f: res += 1
        else: f = True
    else:
        f = False
    res += x//2
print(res)
# Judge status: Accepted
a,b,c=map(int,input().split())
if min(a,b) <= c <=max(a,b):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a,b,k = map(int,input().split())
takahashi = 0
aoki = 0
if a >= k:
    takahashi = a-k
    aoki = b
else:
    takahashi = 0
    aoki = b-k+a
if aoki < 0:
    aoki = 0
print(takahashi,aoki)
# Judge status: Accepted
lis = []
ans = 0
for i in range(5):
    a = int(input())
    amari = a%10
    if a%10 == 0:
        amari = 10
    lis.append([a, 10-amari])
lis = sorted(lis, key=lambda x:x[1])
#print(lis)
for i in range(4):
    ans += lis[i][0] + lis[i][1]
    #print(ans)
ans += lis[4][0]
print(ans)
# Judge status: Wrong Answer
X, Y = map(int,input().split())
print(X + Y/2)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

rate_list = [0, 0, 0, 0, 0, 0, 0, 0]
perfect = 0

for i in range(n):
    rate = a[i]//400
    if rate < 8:
        if rate_list[rate] == 0:
            rate_list[rate] += 1
    else:
        perfect += 1

print('rate_list: ', rate_list)
mini = max(sum(rate_list), 1)
maxi = sum(rate_list)+perfect

print(mini, maxi)
# Judge status: Wrong Answer
a,b,x = map(int,input().split())
tmp = 0

if a%x==0 or b%x==0:
    tmp += 1
print((b-a)//x+tmp)
# Judge status: Accepted
n=int(input())
w=list(map(int,input().split()))
su =sum(w)

ans = 1234567890
cnt =0

for i in range(n):
    cnt += w[i]
    ans = min(ans,abs(su-cnt - cnt))
print(ans)