Harryxun/stf_run huggingface dataset:
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
start = 0
end = A[-1]
while end - start != 0:
   l = (start + end)/2
   count = 0
   for i in range(N):
      count += (A[i]-1)//l
   if count > K:
      start = int(l)
   else:
      end = int(l+1)
print(int(l)+1)

### FIXED CODE ###

X = int(input())
if X > 29:
   print('Yes')
else:
   print('No')
a,b=map(int,input().split())
if a-2b<=0:
  print(0)
else:
  print(a-2b)

### FIXED CODE ###

a,b=map(int,input().split())
print(0 if a<=(2*b) else a-(2*b))
n=input()
a=list(int,input().split())
count=0
while (i%==0):
  a=a/2
  count+=1
print(count)

### FIXED CODE ###

num=int(input())
a=list (map(int,input().split()))
count=0
while  all(i%2==0 for i in a):
  a=[i/2 for i in a]
  count+=1
print(count)
N = input()
num = int(N)
Nls = list(N)
sum1 = sum([int(i) for in Nls])
if num%sum1 == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = input()
num = int(N)
Nls = list(N)
sum1 = sum([int(i) for i in Nls])
if num%sum1 == 0:
  print('Yes')
else:
  print('No')
x,y,z,K = map(int,input().split())
abc = [sorted(list(map(int,input().split())), reverse=True) for i in range(3)]

ans=[]
ab=[]

for i in range(x):
    for j in range(y):
        if (i+1)*(j+1) <= K:
            ab.append(abc[0][i]+abc[1][j])

ab.sort(reverse=True)

for i in range(K):
    for j in range(z):
        if (i+1)*(j+1)> <= K:
            ans.append(ab[i]+abc[2][j])
    
ans.sort(reverse=True)

for i in range(K):
    print(ans[i])

### FIXED CODE ###

x,y,z,K = map(int,input().split())
abc = [sorted(list(map(int,input().split())), reverse=True) for i in range(3)]

ans=[]
ab=[]

for i in range(x):
    for j in range(y):
        if (i+1)*(j+1) <= K:
            ab.append(abc[0][i]+abc[1][j])

ab.sort(reverse=True)

for i in range(min([len(ab),K])):
    for j in range(z):
        if (i+1)*(j+1) <= K:
            ans.append(ab[i]+abc[2][j])
    
ans.sort(reverse=True)

for i in range(K):
    print(ans[i])
k,n = map(int, input().split())
a = list(map(int, input().split()))

if a[0] == 0:
    print(a[n-1]-n[1])
else:
    print(a[n-1]-n[0])

### FIXED CODE ###

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

b = []
for i in range(n-1):
    b.append(a[i+1]-a[i])
b.append((k-a[n-1])+a[0])
print(k-max(b))
a, b, c = map(int, input().split())


if a == b:
    num1 = a
else:
    num1 = a - b

if c =< num1:
    print(0)
else:
    print(c - num1)

### FIXED CODE ###

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

diff = a - b

if c < diff:
    print(0)
else:
    print(c - diff)
import numpy as np
N = int(input())
A = list(int(input()) for i in range(N))
for i in range(N):
    p= A[i]

    M = max(A)
    del A[i]
    MM = max(A)
    if M == MM:
        print(M)
    else:
        print(MM)
    A.insert(i,p)

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B= sorted(A)

for i in range(N):
    if A[i] == B[N-1]:
        ans = B[N-2]
        print(ans)
    else:
        print(B[N-1])
a,b = map(int, input())
if a + b >= 10:
    print("error")
else:
    print(a+b)


### FIXED CODE ###

a,b = map(int, input().split())
if a + b >= 10:
    print("error")
else:
    print(a+b)
S = input()
sort(S)
a = 'Yes'
if S[0] == S[-1]:
  a = 'No'
print(a)

### FIXED CODE ###

S = input()
S = sorted(S)
a = 'Yes'
if S[0] == S[-1]:
  a = 'No'
print(a)
import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
B = np.array(A)

X = np.identity(N)
for i in range(N-1):
    X[i,i+1] = 1
X[N-1,0] = 1

ans = np.linalg.solve(X,B)
for i in range(N):
    print("{}".format(2*int(ans[i])),end=" ") 

### FIXED CODE ###

import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
total = sum(A)
X = np.zeros(N)
X[0] = total 

n =int((N-1)/2 )
for i in range(1,n+1):
    X[0] = X[0] - 2*A[2*i-1]
for j in range(1,N):
    X[j] = 2*A[j-1] - X[j-1]
for i in range(N):
    print("{}".format(int(X[i])),end=" ")
N,M=map(int,input().split())

A=[int(input())for i in range(M)]

print(N-sum(A))

### FIXED CODE ###

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

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

if N-sum(A)>=0:
    print(N-sum(A))
    
else:
    print('-1')
N = int(input())
l = list(map(int,input().split()))
a = np.array(l)
count = 0

for i in range(len(a)):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5== 0:
            count += 1

if count:
    print("DENIED")
else:
    print("APPROVED")

### FIXED CODE ###

import numpy as np
 
N = int(input())
l = list(map(int,input().split()))
a = np.array(l)
count = 0

for i in range(len(a)):
    if a[i]%2 == 0:
        if a[i]%3 != 0 and a[i]%5 != 0:
            count += 1

if count:
    print("DENIED")
else:
    print("APPROVED")
from collections import deque
p = 10**9+7
x,y = map(int,input().split())
x += 1 ; y += 1
map_a=[[0]*y for _ in range(x)]
d = [(2,1),(1,2)]
que = deque()
que.append((0,0))

map_a[0][0] = 1

print(map_a)
while que:
    a,b = que.popleft()
    for u,v in d:
        m = a + u ; n = b + v
        if 0<=m<x and 0<=n<y:
            map_a[m][n] += map_a[a][b]%p
            que.append((m,n))

print(map_a[-1][-1])


### FIXED CODE ###

x,y = map(int,input().split())
m = 10**9+7
if not((x+y)%3== 0 and abs(x-y)<=(x+y)//3):
    print(0);exit()

def comb(n,k):
    #if 2 * k > n:
        #k = n - k
    a = 1
    for i in range(1,k+1):
        a *= (n - ( i - 1)) * pow(i,m-2,m)
        a = a%m
    return a

n = (x+y)//3
k = x-n
print(comb(n,k))
a=int(input())
if a>999:
  print("ABC"+a)
else:
  print("ABD"+a%999)

### FIXED CODE ###

a=int(input())
if 1<=a<=999:
  print("ABC")
else:
  print("ABD")
from math import sqrt

eps = 1e-8

def eq(a, b):
    return a + eps > b and a - eps < b

a, b, c = list(map(int, input().split()))
elif 2 * sqrt(a * b) < c - a - b - eps:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(arr[k - 1])
from itertools import accumulate
from bisect import bisect_left

n, m, k = map(int, input().split())
a = [0] + list(accumulate(list(map(int, input().split()))))
b = [0] + list(accumulate(list(map(int, input().split()))))
ans = 0

for i in range(n + 1):
    if a[i] + b[bisect_left(b, k - a[i])] <= k:
        ans = max(ans, i + bisect_left(b, k - a[i]))
    
print(ans)

### FIXED CODE ###

from itertools import accumulate

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

c = [0] + list(accumulate(a))
d = [0] + list(accumulate(b))

ans = 0
i = 0
j = len(b)

while True:
    num = c[i] + d[j]
    if num > k and j >= 1:
        while True:
            j -= 1
            if j == 0 or c[i] + d[j] <= k:
                break
    if c[i] + d[j] <= k:
        ans = max(ans, i + j)
    if i == len(a):
        break
    while True:
        i += 1
        if i == len(a) or c[i] + d[j] > k:
            i -= 1
            break
    if c[i] + d[j] <= k:
        ans = max(ans, i + j)
    i += 1

print(ans)
x = int(input())

def get_numprime(n):
  nums = [i + 1 for i in range(2, n, 2)]
  prime = [2]
  while True:
    p = nums[0]
    if  p>=x:
      return p
    prime.append(p)
    nums = [e for e in nums if e%p !=0]

if x==2:
  print(x)
else:
  print(get_numprime(x+20))


### FIXED CODE ###

import math
x = int(input())

def is_prime(x):
  for i in range(2, int(math.sqrt(x))+1):
    if x%i==0:
      return False
  return True

while not is_prime(x):
  x+=1
print(x)
s = input()
if s === 'RRR':
    print(3)
elif s[:2] == 'RR' or s[1:] == 'RR':
    print(2)
elif s.count('R') >= 1:
    print(1)
else:
    print(0)

### FIXED CODE ###

s = input()
if s=='RRS' or s=='SRR':
    print(2)
elif s=='RRR':
    print(3)
elif s=='SSS':
    print(0)
else:
    print(1)
n=[input() for i in range(4)]
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n=list(input())
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
    print("Yes")
else:
    print("No")
s=int(input())
s=str(s)
a=int(s[0]);b=int(s[1]);c=int(s[2])
sum=a+b+c

if sum == 0:
  print('0')
elif sum == 1:
  print('1')
elif sum == 2:
  print('2')
else:
  print('3')

### FIXED CODE ###

s = list(input())
c = 0


for i in range(3):
  if s[i] == '1':
    c += 1
   

print(c)
N = int(input())
power = 1
for i in range(N):
  power *= i+1
print(power / (pow(10, 9) + 7))

### FIXED CODE ###

N = int(input())
power = 1
for i in range(N):
  power = (power*(i+1)) % (10**9+7)
print(power)
n,k = map(int,input().split());

if n == k:
    print(0);
elif n > k:
    n = n - k;
    a = [n];
    i = 0;
    while True:
        n = n-k;
        if n < 0:
            break;
        a.append(n);
        i += 1;
else:
    n = k - n;
    a = [n];
    i = 0;
    while True:
        n = n-k;
        if n < 0:
            break;
        a.append(n);
        i += 1;

if a[i] <= (-1)*n:
    print(a[i]);
else:
    print((-1)*n);

### FIXED CODE ###

n,k = map(int,input().split());
i = 0;
if n == k:
    print(0);
elif n < k:
    print(min(n,k-n));
else:
    v = (n - k)%k;
    if v*2 >= k:
        print(k-v);
    else:
        print(v);
a,b=map(int,input().split())
if a>b:
  print('Alice')
if a=b:
  print('Draw')
else:
  print('Bob')

### FIXED CODE ###

a,b=map(int,input().split())
if a==b:
  print('Draw')
elif a==1:
  print('Alice')
elif b==1:
  print('Bob')
elif a > b:
  print('Alice')
else:
  print('Bob')
while True:
    a, op, b = map(str, input().split())
    a = int(a)
    b = int(b)
    if 0 < a < 20001 and 0 < b < 20001:
        if op == "+":
            answer = a + b
            print(answer)
        elif op == "-":
            answer = a - b
            print(answer)
        elif op == "*":
            answer = a * b
            print(answer)
        elif op == "/":
            answer = a / b
            print(answer)
        elif op == "?":
            break
    else:
        continue

### FIXED CODE ###

import math

while True:
    a, op, b = map(str, input().split())
    a = int(a)
    b = int(b)
    if 0 <= a and b < 20001:
        if op == "+":
            answer = a + b
            print(answer)
        elif op == "-":
            answer = a - b
            print(answer)
        elif op == "*":
            answer = a * b
            print(answer)
        elif op == "/":
            answer = a / b
            print(math.floor(answer))
        elif op == "?":
            break
    else:
        if op == "?":
            break
        else:
            continue
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D = map(int,input().split())
lcm = lcm(C,D)
print((B - A + 1) - ((B // D - (A - 1) // D) + (B // C - (A - 1) // C) - (B // lcm - (A - 1) // lcm)))

### FIXED CODE ###

import fractions

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

A,B,C,D = map(int,input().split())
lcm = lcm(C,D)
print((B - A + 1) - ((B // D - (A - 1) // D) + (B // C - (A - 1) // C) - (B // lcm - (A - 1) // lcm)))
a, b, c = map(int,raw_input().split())
if a>b and b > c:
  print ("Yes")
else
  print ("No")

### FIXED CODE ###

a,b,c=map(int, raw_input().split())
if a < b and b < c:
  print ('Yes')
else:
  print ('No')
from scipy.misc import comb
X = 10 ** 9 + 7

n, k = map(int, input().split())
c = n - k + 1

for i in range(1, k+1):
    print(int(comb(c, i) * comb(k-1, i-1) % X))


### FIXED CODE ###

from scipy.misc import comb
X = 10 ** 9 + 7

n, k = map(int, input().split())
c = n - k + 1

for i in range(1, k+1):
    print(int(comb(c, i, exact=True) * comb(k-1, i-1, exact=True)) % X)
import math


def erastos(n):
    n += 1
    try:
        v = [0 if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else 1 for i in range(n)]
        v[0] = v[1] = 0
        v[2] = v[3] = v[5] = 1
    except IndexError:
        return [0, 0, 1, 1, 0, 1][:n]
    sqrt = math.sqrt(n)
    for serial in range(3, n, 2):
        if serial > sqrt:
            return v
        for s in range(serial ** 2, n, serial):
            v[s] = 0

if __name__ == '__main__':
    while True:
        n = int(input())
        v = erastos(n)
        primes = [i for i, b in enumerate(v) if b == True]
        print(len(primes))

### FIXED CODE ###

import sys

primes = [1] * 500000
primes[0] = 0

for i in range(3, 1000, 2):
    if primes[i // 2]:
        primes[(i * i) // 2::i] = [0] * len(primes[(i * i) // 2::i])

for i in sys.stdin:
    n = int(i)
    if n < 4:
        print(n - 1)
    else:
        print(sum(primes[:(n + 1) // 2]) + 1)
N=list(input())

n=reversed(N)

if n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9":
    print("hon")
if n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8":
    print("pon")
if n[0]=="3":
    print("bon")


### FIXED CODE ###

n=list(input())

n==n.reverse()

if (n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9"):
    print("hon")
elif (n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8"):
    print("pon")
elif (n[0]=="3"):
    print("bon")
from math import gcd
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
    a = m%n
    b = m//n
    c = a+b
    while True:
        if gcd(b,c)!=1:
            print(gcd(b,c))
            exit()
        else:
            c -= 1
print(1)

### FIXED CODE ###

n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m/n
  l = []
  for i in range(int(m**0.5),0,-1):
    if m%i==0:
      l.append(i)
      l.append(m//i)
  l = sorted(l)[::-1]
  for j  in l:
    if j<=a:
      print(j)
      exit()
  else:
    print(1)
from math import gcd
n = int(input())
a = list(map(int, input().split()))
l = 1
for x in a:
    l = l * x // gcd(l, x)
ans = 0
for x in a:
    ans += l // x
print(ans % (10 ** 9 + 7))


### FIXED CODE ###

from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
l = 1
for x in a:
    l = l * x // gcd(l, x)
ans = 0
for x in a:
    ans += l // x
print(ans % (10 ** 9 + 7))
import bisect as bc
 
N = int(input())
A = list(map(int,input().split()))
A.sort()
 
dp = [True for _ in range(A[-1]+1)]
 
for i in range(N):
    ai = A[i]
    for j in range(2,A[-1]+1):
        if ai*j > A[-1]:
            break
        dp[ai*j] = False
 
ans = 0
for i in range(N):
    if dp[A[i]]:
        if bc.bisect_right(A,A[i]) - bc.bisect_left(A,A[i]) == 1:
            ans += 1
            finish[A[i]] = False
 
print(ans)

### FIXED CODE ###

x = list(map(int,input().split()))
print(x.index(0)+1)
s,t =,map(str,input().split())

x = t+s

print(x)


### FIXED CODE ###

s,t = map(str,input().split())

print(t+s)
X = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]

for i in range(100000):
    C = X + (i**5)
    if C**(1/5)%1 ==0:
        print(int(C**(1/5)), i)
        break
    C = X - (i**5)
    if C**(1/5)%1 ==0:
        print(int(C**(1/5)), -i)
        break


### FIXED CODE ###

X = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
A = [i**5 for i in range(200)]
B = [i**5 for i in range(200)]
# = [list(map(int, input().split())) for i in range(N)]

for i in range(200):
    for j in range(200):
        if A[i] + B[j] == X:
            print(int(A[i]**(1/5)), int(B[j]**(1/5)*(-1)))
            exit()
        if A[i] - B[j] == X:
            print(int(A[i]**(1/5)), int(B[j]**(1/5)))
            exit()
from math import ceil
x=int(input())
i=0
if x<=2:
  print(2)
elif x==3:
  print(3)
elif x==4:
  print(5)
else:
  while 1:
    ok=True
    n=ceil((x+i)**0.5)
    for j in range(2,n):
      if (x+i)%j==0:
        ok=False
        break
    if ok:
      print(x+i)
      exit()
    i+=1


### FIXED CODE ###

s,t=input().split()
print(t+s)
a = int(input())
if a = 25:
  print('Christmas')
elif a = 24:
  print('Christmas Eve')
elif a = 23:
  print('Christmas Eve Eve')
elif a = 22:
  print('Christmas Eve Eve Eve')

### FIXED CODE ###

a = int(input())
if a == 25:
  print('Christmas')
elif a == 24:
  print('Christmas Eve')
elif a == 23:
  print('Christmas Eve Eve')
elif a == 22:
  print('Christmas Eve Eve Eve')
L = list(input())
A = list("keyence")

prev = -1
for i, a in A:
  curr = L.index(a)
  if prev < current:
    continue
  else:
    print("NO")
    exit()
print("YES")

### FIXED CODE ###

L = input()
A = 'keyence'

for i in range(len(L)):
    for j in range(i, len(L)):
        if L[:i] + L[j:] == A:
            print("YES")
            exit()
print("NO")
a,b = map(int, input().split(" ")

if a<b
 print("a<b")
elif a>b
 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")
import math
import bisect
from collections import deque
n, ticket = map(int, input().split())
L = list(map(int, input().split()))


if len(L) == 1:
    print(math.floor(L[0] / (2**ticket)))
else:
    L.sort()
    L = deque(L)
    for _ in range(ticket):
        top = L.pop()
        top /= 2
        bisect.insort_left(L,top)
    print(sum(map(math.floor, L)))

### FIXED CODE ###

import math
import heapq
n, ticket = map(int, input().split())
L = list(map(int, input().split()))
h = []
for num in L:
    heapq.heappush(h, -num)
for _ in range(ticket):
    top = heapq.heappop(h)
    top /= 2
    heapq.heappush(h, top)
print(sum(map(lambda x: math.floor(-x), h)))
x, n = map(int, input().split())
lp = list(map(int, input().split()))

lp.sort()

distance = 0
try:
    idx = lp.index(x)
    while True:
        distance += 1
        dmin = x-distance
        dmax = x+distance
        if dmin != lp[idx-distance]:
            print(dmin)
            exit()
        if dmax != lp[idx+distance]:
            print(dmax)
            exit()
except ValueError:
    print(x)
    exit()

### FIXED CODE ###

x, n = map(int, input().split())
lp = list(map(int, input().split()))

lp.sort()

distance = 0
try:
    idx = lp.index(x)
    while True:
        distance += 1
        dmin = x-distance
        dmax = x+distance
        if (idx-distance) < 0 or dmin != lp[idx-distance]:
            print(dmin)
            exit()
        if (idx+distance) >= len(lp) or  dmax != lp[idx+distance]:
            print(dmax)
            exit()
except ValueError:
    print(x)
    exit()
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(N-1):
        g = lcm(g,T[i+1])
print(g)

### FIXED CODE ###

import math
N = int(input())
T = []

def lcm(x, y):
    gc = math.gcd(x, y)
    ans = (x * y)//gc
    return ans

for i in range(N):
    T.append(int(input()))

    

if len(T) > 2:
    g = lcm(T[0],T[1])
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
elif len(T) == 2:
    g = lcm(T[0],T[1])
    print(g)
else:
    print(T[0])
for i in range(3000):
    a, b = map(int, input().split())
    
    if a == 0 and b == 0
        break
    elif a > b:
        print(a, b)
    else
        print(b, a)
    
    
    


### FIXED CODE ###

for i in range(3000):
    a, b = map(int, input().split())
    
    if a == b == 0:
        break
    elif a < b:
        print(a, b)
    else:
        print(b, a)
N = list[int(i) for i in input().split]
A = list[int(i) for i in input().split]
if all([i%2==1 for i in A]):
    print('APPROVED')
else:
    even = [i for i in A if i%2==0]
    print(even)
    even = [0 if i%3==0 or i%5==0 else 1 for i in even]
    if max(even)==1:
        print('DENIED')
    else:
        print('APPROVED')

### FIXED CODE ###

N = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
if all([i%2==1 for i in A]):
    print('APPROVED')
else:
    even = [i for i in A if i%2==0]
    even = [0 if i%3==0 or i%5==0 else 1 for i in even]
    if max(even)==1:
        print('DENIED')
    else:
        print('APPROVED')
a = input()
b = input()

if a == d and b == c
    print('YES')
else:
    print('NO')


### FIXED CODE ###

a = input()
b = input()

c = a[::-1]
d = b[::-1]

if a == d and b == c:
    print('YES')
else:
    print('NO')
N = int(input())
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(float(sum))

### FIXED CODE ###

N = int(input())
sum=0
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(sum)
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted(list(enumerate(a)), key=lambda x: -x[1])
    L = [i for i in range(n+2)]  # 連結成分のうち一番左のindex
    R = [i for i in range(n+2)]  # 連結成分のうち一番右のindex
    ans = 0
    for i, j in a:  # 1-indexなので1ずれる
        print(L, R)
        M = R[i+1]  # 連結成分の最大値
        m = L[i+1]  # 連結成分の最小値
        ans += j*(M-i)*(i+2-m)  # 計算
        R[m-1] = M  # 連結成分の左端の更新
        L[M+1] = m  # 連結成分の右端の更新
    print(ans)


main()

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a=sorted(list(enumerate(a)),key=lambda x:x[1])

l=1
while l<2*(n+2)-1:
	l*=2
l-=1
seg=[True]*l
seg[0]=False

def update(i):
	if seg[i]:
		seg[i]=False
		update((i-1)//2)

update((l-1)//2)
update((l-1)//2+n+1)

def search_left(i,j):
	if j==1:
		if i%2==1:
			return search_left((i-1)//2,1)
		else:
			if seg[i-1]:
				return search_left((i-1)//2,1)
			else:
				return search_left(i-1,0)
	else:
		if i<l//2:
			return search_left(2*i+2-seg[2*i+2],0)
		else:
			return i

def search_right(i,j):
	if j==1:
		if i%2==0:
			return search_right((i-1)//2,1)
		else:
			if seg[i+1]:
				return search_right((i-1)//2,1)
			else:
				return search_right(i+1,0)
	else:
		if i<l//2:
			return search_right(2*i+1+seg[2*i+1],0)
		else:
			return i

ans=0
for i,j in a:
	s=(l//2+1+i)
	p=search_left(s,1)
	q=search_right(s,1)
	ans+=(s-p)*(q-s)*j
	update(s)

print(ans)
while(1):
    n = input()
    if n == '_':
        exit()
    m = int(input())
    for i in range(m):
        h = int(input())
        n = n[h:] + n[0:h]
    print(n)

### FIXED CODE ###

while(1):
    n = input()
    if n == '-':
        exit()
    m = int(input())
    for i in range(m):
        h = int(input())
        n = n[h:] + n[0:h]
    print(n)
a,b = map(int,input.split())
if (a+b)%2 ==0 :
    print((a+b/2))
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

A,B = map(int,input().split())
 
if (A+B)%2 == 0:
    print((A+B)//2)
else:
    print("IMPOSSIBLE")
a,b = map(int,input().split())
if a > b:
	print(“a > b”)
elif a < b:
	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")
N, Q = map(int, input().split())
A = [[] for _ in range(N)]
for _ in range(N-1):
    i, k = map(int, input().split())
    A[i-1].append(k-1)
n_P = [0] * N
for _ in range(Q):
    k, n = map(int, input().split())
    n_P[k-1] += n
ans = [0] * N
visited = []
def make(num, A, p):
    for i in A[num]:
        visited.append(i)
        n_P[i] += p
        make(i, A, n_P[i])
    return
for i in range(N):
    if i not in visited:
        make(0, A, n_P[0])
print(*n_P)

### FIXED CODE ###

import sys
sys.setrecursionlimit(2*10**9)
N, Q = map(int, input().split())
A = [[] for _ in range(N)]
for _ in range(N-1):
    i, k = map(int, input().split())
    A[i-1].append(k-1)
    A[k-1].append(i-1)
n_P = [0] * N
for _ in range(Q):
    k, n = map(int, input().split())
    n_P[k-1] += n
ans = [0] * N
visited = [0] * N
def make(num, p):
    ans[num] += n_P[num] 
    ans[num] += p
    visited[num] = 1
    for i in A[num]:
        if visited[i] == 0:
            make(i,ans[num])
    return
make(0, ans[0])
print(*ans)
#入力
A = int(input())
B = int(input())

if A>8 or B>8:
    print(":(")
elif A<=8 and B<=8:
    print("Yay!")


### FIXED CODE ###

#入力
A,B = map(int, input().split())
 
if A>8 or B>8:
    print(":(")
elif A<=8 and B<=8:
    print("Yay!")
N, M =map(int, input().split())
a =[1]*N
mod = 1000000007
for i in range(M):
  a[int(input())-1]=0

dp = [0]*N

dp[0] = a[0]*1
dp[1] = (dp[0] + 1)*a[1]

for i in range(2,N):
  dp[i] = (dp[i-1]+dp[i-2]) *a[i]
  
print(dp[-1]%mod)
  

### FIXED CODE ###

import sys
N, M =map(int, input().split())


if N == 1:
  print(1)
  sys.exit()

a =[1]*N
mod = 1000000007
for i in range(M):
  a[int(input())-1]=0

  
dp = [0]*N

dp[0] = a[0]*1
dp[1] = (dp[0] + 1)*a[1]

for i in range(2,N):
  dp[i] = (dp[i-1]+dp[i-2]) *a[i]
  
print(dp[-1]%mod)