Harryxun/stf_run huggingface dataset:
def solve(pick, idx):

    if pick == 0: return 0
    if idx >= n: return -float('inf')
    if (pick, idx) in dp: return dp[pick, idx]
    if n-idx+2 < pick*2: return -float('inf')
    total = max(A[idx] + solve(pick-1, idx+2), solve(pick, idx+1))

    dp[(pick, idx)] = total
    return total

n = int(input())
A = list(map(int, input().split()))
dp = {}
pick = n//2

print(solve(pick, 0))
"""
@lru_cache(None)
def F(index, n):
    if index >= N:
        return -INF
    if N - index + 2 < 2 * n:
        return -INF
    if n == 0:
        return 0
    elif n == 1:
        return max(A[index:])
    ret = max(A[index] + F(index+2, n-1), F(index+1, n))
    return ret
"""

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 9)
def solve(pick, idx):

    if pick == 0: return 0
    if idx >= n: return -float('inf')
    if (pick, idx) in dp: return dp[pick, idx]
    if n-idx+2 < pick*2: return -float('inf')
    total = max(A[idx] + solve(pick-1, idx+2), solve(pick, idx+1))

    dp[(pick, idx)] = total
    return total

n = int(input())
A = list(map(int, input().split()))
dp = {}
pick = n//2

print(solve(pick, 0))
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2], *A[N%2::2])

### FIXED CODE ###

from collections import deque
 
N = int(input())
A = [int(i) for i in input().split()]
 
B = deque(maxlen=2*10**5)
 
if N % 2 == 0:
    for i in range(N):
        if i % 2 == 0:
            B.append(A[i])
        else:
            B.appendleft(A[i])
else:
    for i in range(N):
        if i % 2 == 0:
            B.appendleft(A[i])
        else:
            B.append(A[i])
 
print(*B)
import collections

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

mod = 10**9+7

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if is_prime[i]:
            for j in range(i*2, n+1, i):
                is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]

primes = sieve(10**3)

def primeFactorization(n):
  ans = []
  temp = n
  for p in primes:
    while temp%p == 0:
      ans.append(p)
      temp /= p
  if temp > 1:
    ans.append(temp)
  return collections.Counter(ans)

AFactorized = list(map(primeFactorization, A))

lcm = collections.Counter()
for a in AFactorized:
    for p, n in a.items():
        if n > lcm.get(p, 0):
            lcm[p] = n

lcm_val = 1
for p, n in lcm.items():
    lcm_val *= pow(p, n, mod)

ans = 0
for a in A:
    ans += lcm_val * pow(a, mod-2, mod)
    ans %= mod

print(ans)

### FIXED CODE ###

import fractions
from functools import reduce

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

p = 10**9+7

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

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

lcm = lcm_list(A)

B = [lcm//i for i in A]

print(sum(B)%p)
a = int(input())
b = int(input())

if (a% 2 ==0) &  (b% 2 ==0):
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a,b = map(int,input().split())
if (a% 2 ==0)or(b% 2 ==0):
    print("Even")
else:
    print("Odd")
x = input()

x3 = x * x * x

print(x3)

### FIXED CODE ###

x = int(input())

x3 = x ** 3

print(x3)
def Main(N, M, S, C):
    dig = [set([]),set([]),set([])]
    for i in range(M):
        dig[S[i]-1].add(C[i])
    for s in dig:
        if len(s) == 2:
            return -1
    if N == 3:
        if len(dig[0]) > 0 and list(dig[0])[0] == 0:
            return -1
        if len(dig[1]) == 0:
            dig[1].add(0)
        if len(dig[2]) == 0:
            dig[2].add(0)
        return list(dig[0])[0]*100+list(dig[1])[0]*10+list(dig[2])[0]
    elif N == 2:
        if len(dig[0]) > 0 and list(dig[0])[0] == 0:
            return -1
        if len(dig[1]) == 0:
            dig[1].add(0)
        return list(dig[0])[0]*10+list(dig[1])[0]
    else:
        if len(dig[0]) > 0 and list(dig[0])[0] == 0:
            return -1
        return list(dig[0])[0]       
        
                

def main():
    N, M = map(int, input().split())
    if M == 0:
        print(0)
        exit()
    S = [1]*M
    C = [0]*M
    for i in range(M):
        S[i], C[i] = map(int, input().split())
    print(Main(N, M, S, C))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def Main(N, M, S, C):
    dig = [set([]),set([]),set([])]
    for i in range(M):
        dig[S[i]-1].add(C[i])
    for s in dig:
        if len(s) == 2:
            return -1
    if N == 3:
        if len(dig[0]) > 0 and list(dig[0])[0] == 0:
            return -1
        if len(dig[0]) == 0:
            dig[0].add(1)
        if len(dig[1]) == 0:
            dig[1].add(0)
        if len(dig[2]) == 0:
            dig[2].add(0)
        return list(dig[0])[0]*100+list(dig[1])[0]*10+list(dig[2])[0]
    elif N == 2:
        if len(dig[0]) > 0 and list(dig[0])[0] == 0:
            return -1
        if len(dig[0]) == 0:
            dig[0].add(1)
        if len(dig[1]) == 0:
            dig[1].add(0)
        return list(dig[0])[0]*10+list(dig[1])[0]
    else:
        return list(dig[0])[0]       
        
                

def main():
    N, M = map(int, input().split())
    if M == 0:
        if(N == 3):
            print(100)
        elif(N == 2):
            print(10)
        else:
            print(0)
        exit()
    S = [1]*M
    C = [0]*M
    for i in range(M):
        S[i], C[i] = map(int, input().split())
    print(Main(N, M, S, C))

if __name__ == '__main__':
    main()
N, K, C = map(int, input().split())
S = input()
L, R = [0]*N, [0]*N
i = 0
count = 1
while count <= K:
    if S[i] == 'x':
        i += 1
        continue
    L[i] = count
    count += 1
    i += C+1
i = N-1
count = K
while count >= 0:
    if S[i] == 'x':
        i -= 1
        continue
    R[i] = count
    count -= 1
    i -= C+1
for i in range(N):
    if L[i] == 0:
        continue
    if L[i] == R[i]:
        print(i+1)

### FIXED CODE ###

N, K, C = map(int, input().split())
S = input()
L, R = [0]*N, [0]*N
i = 0
count = 1
while count <= K:
    if S[i] == 'x':
        i += 1
        continue
    L[i] = count
    count += 1
    i += C+1
i = N-1
count = K
while count > 0:
    if S[i] == 'x':
        i -= 1
        continue
    R[i] = count
    count -= 1
    i -= C+1
for i in range(N):
    if L[i] == 0:
        continue
    if L[i] == R[i]:
        print(i+1)
N = int(input())

s = []
for i in range(N):
    s.append(''.join(sorted(input())))

s = sorted(s)

tmp_count = 1
count = 0
for i in range(0, len(s)-1):
    if s[i] == s[i+1]:
        tmp_count += 1
    else:
        count += tmp_count * (tmp_count - 1) // 2
        tmp_count = 1
count += tmp_count * (tmp_count - 1) // 2
print(count)

### FIXED CODE ###

#AtCoder Beginner Contest 127
array = list(map(int, input().split()))

plus = array[0] + array[1]
minus = array[0] - array[1]
product = array[0] * array[1]

print(max(plus, minus, product))
N, M = map(int, input().split())
lack = []
for _ in range(M):
    lack.append(int(input()))

def fib(n):
    memo=["EMPTY"]*(n+1)
    def inner(n):
        if n in lack:
            return 0
        elif n == 0:
            return 1
        elif n == 1:
            return 1
        elif memo[n] != "EMPTY":
            return memo[n]
        else:
            memo[n] = inner(n-1)+inner(n-2)
            return memo[n]
    return inner(n) %1000000007

print(fib(N)%1000000007)

### FIXED CODE ###

P, Q, R = map(int, input().split())
lst = [P, Q, R]
lst = sorted(lst)
print(lst[0]+lst[1])
a, b, c, d = (int(i) for i in input().split())
print(min(a,b) + min(c,d))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b) + min(c,d))
a,b=map(int,input())
l=list(range(a,b+1))
s=[]
for i in range(len(l)):
    if str(l[i])[0]==str(l[i])[4] and str(l[i])[1]==str(l[i])[3]:s.append(l[i])
print(len(s))

### FIXED CODE ###

a,b=map(int,input().split())
l=list(range(a,b+1))
s=[]
for i in range(len(l)):
    if str(l[i])[0]==str(l[i])[4] and str(l[i])[1]==str(l[i])[3]:s.append(l[i])
print(len(s))
from collections import deque
x,y,a,b,c = map(int ,input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p_que = deque([])
q_que = deque([])
r_que = deque([])
for i in range(a):
    p_que.append(p[i])
for i in range(b):
    q_que.append(q[i])
for i in range(c):
    r_que.append(r[i])

yamm = 0

for i in range(x):
    if p_que[0] >= r_que[0]:
        ma = int(p_que.popleft())
        yamm += ma
    else:
        ma = int(q_que.popleft())
        yamm += ma

for i in range(y):
    if q_que[0] >= r_que[0]:
        ma = int(q_que.popleft())
        yamm += ma
    else:
        ma = int(r_que.popleft())
        yamm += ma

print(yamm)

### FIXED CODE ###

x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)

p = p[:x]
q = q[:y]

s = p+q+r
s.sort(reverse=True)

print(sum(s[:(x+y)]))
a, b = map(int, input().split())
if a % 2 == 0 or b % 2 == 0:
  return "Even"
else:
  return "Odd"

### FIXED CODE ###

a, b = map(int, input().split())
if a % 2 == 0 or b % 2 == 0:
    print("Even")
else:
    print("Odd")
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())

    N = II()
    info = []
    MAXL = 101
    b = [[0] * MAXL for _ in range(MAXL)]

    def vtop(x1,x2,y1,y2,h1):
        ans = h1 + abs(x1-x2) + abs(y1-y2)
        return ans if ans <= 10**9 else 0

    # get info
    initidx = -1000
    for i in range(N):
        x,y,h = LMIIS()
        info.append((x,y,h))
        if h > 0:
            initidx = i
    if len(info) != N:
        return

    # init candidates
    x,y,h = info[initidx]
    for i in range(MAXL):
        for j in range(MAXL):
            b[i][j] = vtop(x,j,y,i,h)

    # check
    for x,y,h in info:
        for i in range(MAXL):
            for j in range(MAXL):
                if h == 0:
                    if b[i][j] > vtop(x,j,y,i,h):
                        b[i][j] = 0

                else:
                    if b[i][j] != vtop(x,j,y,i,h):
                        b[i][j] = 0

    # answer
    ansl = []
    for i in range(MAXL):
        for j in range(MAXL):
            if b[i][j] > 0:
                ansl.append((j,i,b[i][j]))
    
    ansl2 = []
    for x0,y0,h0 in ansl:
        f = True
        for x1,y1,h1 in info:
            
            if max(h0-abs(x0-x1)-abs(y0-y1),0) != h1:
                f = False
                break
        if f:
            ansl2.append((x0,y0,h0))
    x,y,h= ansl2[-1]
    print(x,y,h)


if __name__ == '__main__':
    main()

### FIXED CODE ###

#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(input = sys.stdin.readline):
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())

    N = II()
    info = []
    for _ in range(N):
        xi, yi, hi = LMIIS()
        if hi != 0:
            xt, yt, ht = xi, yi, hi
        info.append((xi, yi, hi))

    for Cy in range(101):
        for Cx in range(101):
            H = ht + abs(xt - Cx) + abs(yt - Cy)
            found = True
            for xi, yi, hi in info:
                tmp_h = max(H - abs(Cy-yi) - abs(Cx-xi), 0)
                if tmp_h != hi:
                    found = False
                    break
            if found:
                print('{} {} {}'.format(Cx,Cy,H))
                return



if __name__ == '__main__':
    main()
#!/usr/bin/env python3
import time


def main():
    # from scipy.special import comb
    from math import factorial

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

    num_lst = [0] * (N + 1)
    for a in A:
        num_lst[a] += 1

    ans = 0
    for num in num_lst:
        # ans += comb(num, 2, exact=True)
        if num >= 2:
            ans += int(factorial(num) / 2 / factorial(num - 2))
        else:
            ans += 0

    start = time.time()
    for a in A:
        print(ans - (num_lst[a] - 1))
    end = time.time() - start
    # print(f'{end:6f}', '[sec]')


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
def main():
    import time

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

    num_lst = [0] * (N + 1)
    for a in A:
        num_lst[a] += 1

    ans = 0
    for num in num_lst:
        # ans += comb(num, 2, exact=True)
        ans += num * (num - 1) // 2

    start = time.time()
    for a in A:
        print(ans - (num_lst[a] - 1))
    end = time.time() - start
    # print(f'{end:6f}', 's')


if __name__ == '__main__':
    main()
n = int(input())
a = sorted(list(map(int, input().split())))

import math
def comb(n,r):
  return math.factorial(n) / (math.factorial(r) * math.factorial(n-r))
  
max_comb = [comb(i, i // 2) for i in range(n-1)]

mid_dis = [abs(a[n-1] / 2 - a[i]) for i in range(n-1)]
arg_max_i = [i for i in range(n-1) if mid_dis[i] == min(mid_dis)][0]

print(a[n-1], a[arg_max_i])


### FIXED CODE ###

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

import bisect

arg_max_i = bisect.bisect_left(a, a[n-1] // 2)

if abs(a[n-1] / 2 - a[arg_max_i]) > abs(a[n-1] / 2 - a[arg_max_i-1]):
  arg_max_i -= 1
if arg_max_i == n-1:
  arg_max_i -= 1

print(a[n-1], a[arg_max_i])
N = int(input())
K = int(input())
X = list(map(int, input().split()))

sum_len = 0
for i in X:
    if X < abs(K-X[i]):
        sum_len += X * 2
    else:
        sum_len += abs(K-X[i]) * 2

print(sum_len)

### FIXED CODE ###

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

sum_len = 0
for i in range(len(X)):
    if X[i] < abs(K-X[i]):
        sum_len += X[i] * 2
    else:
        sum_len += abs(K-X[i]) * 2

print(sum_len)
s=list(map(str,input().split()))
price=700

for i in s:
  if s[i]=="o":
    price+=100
  else:
    price=price

print(price)

### FIXED CODE ###

S=list(input())
count=0

if S[0]=='o':
  count+=1
if S[1]=='o':
  count+=1
if S[2]=='o':
  count+=1
  
print(count*100+700)
from collections import deque
 
def main():
    h, w = map(int, input().split())
    maze= [list(input()) for i in range(h)]
    route = [[-1] * w for i in range(h)]
    que = deque([])
    
    for i in range(h):
        for j in range(w):
           if maze[i][j] == "#":
               que.append([i, j])
               route[i][j] = 0
            
    while que:
        x, y = que.popleft()
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4): 
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < h and 0 <= ny < w and route[nx][ny] == -1:
                route[nx][ny] = route[x][y] + 1
                que.append([nx, ny])

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, d[i][j])
    print(ans)

    return

if __name__ == '__main__':
    main()

### FIXED CODE ###

from subprocess import call
call (('pypy3', '-c', """
from collections import deque
 
def main():
    h, w = map(int, input().split())
    A = [list(input()) for _ in range(h)]
    d = [[10**9] * w for _ in range(h)]
    que = deque([])
    
    for i in range(h):
        for j in range(w):
           if A[i][j] == "#":
               que.append([i, j])
               d[i][j] = 0
           else:
               d[i][j] = 10 ** 9
            
    while que:
        x, y = que.popleft()
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4): 
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < h and 0 <= ny < w and d[nx][ny] == 10**9:
                d[nx][ny] = d[x][y] + 1
                que.append([nx, ny])
    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, d[i][j])
    print(ans)
    
    return
    
main()
 
"""))
import numpy as np
 
N, K = map(int, input().split())
h_i = np.array(map(int, input().split()))

can_ride = h_i[h_i>=K]
print(len(can_ride))

### FIXED CODE ###

import numpy as np
 
N, K = map(int, input().split())
h_i = list(map(int, input().split()))
h_i = np.array(h_i)
can_ride = h_i[h_i>=K]
print(len(can_ride))
n, k = map(int, input().split())
l = list(map(int, input().split))
l.sort(revese = True)
sum_l=0
for i in range(0,k):
    sum_l+=l[i]

print(sum_l)

### FIXED CODE ###

n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse = True)
sum_l=0
for i in range(0,k):
    sum_l+=l[i]

print(sum_l)
S=input()
print(S.replace("x"))

### FIXED CODE ###

print("x"*len(input()))
n=int(input())
name={}
name["M"]=0
name["A"]=0
name["R"]=0
name["C"]=0
name["H"]=0
for _ in range(n):
    s=list(input())
    if s[0] not in name:
        name[s[0]]=1
    else:
        name[s[0]]+=1
cnt=[name["M"],name["A"],name["R"],name["C"],name["H"]]
ans=0
for i in range(n-2):
    for j in range(n-i-2):
        j+=i+1
        for k in range(n-j-1):
            k+=j+1
            ans+=cnt[i]*cnt[j]*cnt[k]
print(ans)


### FIXED CODE ###

n=int(input())
name={}
name["M"]=0
name["A"]=0
name["R"]=0
name["C"]=0
name["H"]=0
for _ in range(n):
    s=list(input())
    if s[0] not in name:
        name[s[0]]=1
    else:
        name[s[0]]+=1
cnt=[name["M"],name["A"],name["R"],name["C"],name["H"]]
ans=0
n=5
for i in range(n-2):
    for j in range(n-i-2):
        j+=i+1
        for k in range(n-j-1):
            k+=j+1
            ans+=cnt[i]*cnt[j]*cnt[k]
print(ans)
a, b, c, d = map( int, input().split() )
 
for i in range( 200 ):
    c = c - b
    if c <= 0:
        print( "Yes" )
        exit()
 
    a = a - d
    if a <= 0:
        print( "No" )
        exit()

        
a,b,c,d=map(int, input().split() )
 
for i in range( 200 ):
    c=c-b
    if c<=0:
  		print("Yes")
  		break
	a=a-d
  	if a<=0:
  		print("No")
  		break

### FIXED CODE ###


a, b, c, d = map( int, input().split() )
#print( a, b, c, d )
 
for i in range( 200 ):
    c = c - b
    if c <= 0:
        print( "Yes" )
        exit()
 
    a = a - d
    if a <= 0:
        print( "No" )
        exit()
import sys
input = sys.stdin.readline
H,W = map(int,input().rstrip().split())
h,w = map(int,input().rstrip().split())
cells = [[1]*W]*H
cells = cells[h:]
cells = list(zip(*cells))
cells = cells[w:]
cells = list(zip(*cells))
print(sum(list(map(sum,[*cells]))))

### FIXED CODE ###

import sys
input = sys.stdin.readline
H,W = map(int,input().rstrip().split())
h,w = map(int,input().rstrip().split())
cells = [[1]*W]*H
cells = cells[h:]
cells = list(zip(*cells))
cells = cells[w:]
print(sum(list(map(sum,list(zip(*cells))))))
"""
keyword: 尺取法
"""

import sys
sys.setrecursionlimit(10**6)

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

nums = []
now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか

for i in range(n):
    if s[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now ^= 1 # 0と1を切り替える
        cnt = 1 # 新しいのをカウント
if cnt != 0:
    nums.append(cnt)

# 1-0-1-0-1-0-1って感じの配列が欲しい
# 1-0-1-0みたいに0で終わっていたら、適当に1つ足す
# 補足：1-0-1-0-1というのは、1が0個、0が2個、1が1個、、、などと並んでいるという意味。このとき1つ目の0をひっくり返すと1-1-1と連続する。1-...-1と連続している数が求める値なので、左端と右端は1にしたい
if len(nums)%2 == 0:
    nums.append(0)
    
add = 2*k+1

# 累積和を作る
tot = [0]*(len(nums)+1)
for i in range(len(tot)):
    tot[i+1] = tot[i]+nums[i]

ans = 0

# 1-0-1...の、1から始まり1で終わる範囲を見るので、偶数番目だけ見る
for i in range(0, len(nums), 2):
    
    # 次のleft, rightを計算する
    left = i
    right = min(i+add, len(nums))
    tmp = tot[right] - tot[left]
    
    ans = max(tmp, ans)
    
print(ans)

### FIXED CODE ###

"""
keyword: 尺取法
"""

import sys
sys.setrecursionlimit(10**6)

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

nums = []
now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか

for i in range(n):
    if s[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now ^= 1 # 0と1を切り替える
        cnt = 1 # 新しいのをカウント
if cnt != 0:
    nums.append(cnt)

# 1-0-1-0-1-0-1って感じの配列が欲しい
# 1-0-1-0みたいに0で終わっていたら、適当に1つ足す
# 補足：1-0-1-0-1というのは、1が0個、0が2個、1が1個、、、などと並んでいるという意味。このとき1つ目の0をひっくり返すと1-1-1と連続する。1-...-1と連続している数が求める値なので、左端と右端は1にしたい
if len(nums)%2 == 0:
    nums.append(0)
    
add = 2*k+1

ans = 0
left = 0
right = 0
tmp = 0 # [left, right)のsum

# 1-0-1...の、1から始まり1で終わる範囲を見るので、偶数番目だけ見る
for i in range(0, len(nums), 2):
    
    nextleft = i
    nextright = min(i+add, len(nums))
    
    # 左端を移動
    while (nextleft > left):
        tmp -= nums[left]
        left += 1
    # 右端を移動
    while (nextright > right):
        tmp += nums[right]
        right += 1
        
    ans = max(tmp, ans)
    
print(ans)
n, m  = map(int, input().split())
a = n // 2
d = 1
memo = []
for i in range(m):
    for mi in memo:
        if d + mi == n:
            print(1 / 0)
    memo.append(d)
    print(a, a+d)
    a -= 1
    d += 2

### FIXED CODE ###

n, m = map(int, input().split())

a = (n - 1) // 2
d = 1
memo = set([])
cnt = 0
for i in range(m):

    if (n - d in memo) or (2*d == n):
        cnt += 1
        d += 1
    memo.add(d)
    if cnt > 1 or a < 1 or a+d > n:
        print(1/0)
    print(a, a+d)
    a -= 1
    d += 2
S = list(input())
K = int(input())

if len(S) == 1:
    print(K // 2)
else :
    S = list(input())
    K = int(input())
    
    pre = S[0]
    flg = 0
    cnt = 0
    cnt_list =[]
    
    for i in range(1, len(S)):
        cnt += 1
        if flg == 1:
            flg = 0
            pre = S[i]
            continue
        if S[i] == pre:
            cnt_list.append(cnt)
            flg = 1
        pre = S[i]
    
    if S[0] == S[-1] and (S[-1] == S[-2] or S[0] == S[1]):
        print(len(cnt_list)*K)
    elif S[0] == S[-1]:
        print(len(cnt_list)*K+K)
    else :
        print(len(cnt_list)*K)

### FIXED CODE ###

S = input()
K = int(input())
 
if len(S) == 1:
    print(K // 2)
    exit()

chkd, flg = 0, 1
cnt = 0
cnt_list =[]
 
for i in range(1, len(S)):
    cnt += 1
    if S[i] != S[i-1]:
        flg = 0
    if chkd == 1:
        chkd = 0
        continue
    if S[i] == S[i-1]:
        cnt_list.append(cnt)
        chkd = 1
 
# 2個連続の場合
S2 = S*2
chkd = 0
cnt = 0
cnt_list2 =[]
 
for i in range(1, len(S2)):
    cnt += 1
    if chkd == 1:
        chkd = 0
        continue
    if S2[i] == S2[i-1]:
        cnt_list2.append(cnt)
        chkd = 1

if flg: # 全部同じ場合
    print(len(S)*K // 2)
elif S[0] == S[-1]:
    print(len(cnt_list) + (len(cnt_list2)-len(cnt_list)) * (K - 1))
else :
    print(len(cnt_list)*K)
while True:
    flg = True
    S = input()
    if S = '.':
        exit()
    cnt = [0, 0]
    for c in S:
        if c == '[':
            cnt[0] += 1
        elif c == ']':
            cnt[0] -= 1
            if cnt[0] < 0:
                flg = False
                break
        elif c == '(':
            cnt[1] += 1
        elif c == ')':
            cnt[1] -= 1
            if cnt[1] < 0:
                flg = False
                break
        else:
            pass
    if cnt[0]>0 or cnt[1]>0:
        flg = False
    if flg:
        print('yes')
    else:
        print('no')

### FIXED CODE ###

while True:
    flg = True
    S = input()
    if S == '.':
        exit()
    brackets = []
    for c in S:
        if c == '[':
            brackets.append('[')
        elif c == ']':
            if len(brackets) == 0:
                flg = False
                break
            if brackets.pop() != '[':
                flg = False
                break
        elif c == '(':
            brackets.append('(')
        elif c == ')':
            if len(brackets) == 0:
                flg = False
                break
            if brackets.pop() != '(':
                flg = False
                break
        else:
            pass
    if len(brackets) > 0:
        flg = False
    if flg:
        print('yes')
    else:
        print('no')
import numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
output = N - np.sum(A)
if output >= 0:
    print(output)
else:
    print(-1)

### FIXED CODE ###

import numpy as np
N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
if (output := N - np.sum(A)) >= 0:
    print(output)
else:
    print(-1)