Harryxun/stf_run huggingface dataset:
while True:
	n, m = (int(x) for x in raw_input().split())
	if n == 0 and m == 0: break
	p = [int(x) for x in raw_input().split()]
	s = sum(p)
	p.sort(reverse=True)
	for x in p[m - 1::m]:
		s -= x
	print s

### FIXED CODE ###

while True:
	try:
		n, m = (int(x.strip()) for x in raw_input().split())
		if n == 0 and m == 0: break
		p = [int(x.strip()) for x in raw_input().split()]
		s = sum(p)
		p.sort(reverse=True)
		for x in p[m - 1::m]:
			s -= x
		print s
	except:
		pass
import math
a,b,h,m=map(int,input().split())
angle=abs(m*6-(h*30+m/60*30))
print(math.sqrt(a*a+b*b-2*a*b*math.cos(angle/180*pi)))


### FIXED CODE ###

import math
a,b,h,m=map(int,input().split())
angle=abs(m*6-(h*30+m/60*30))
print(math.sqrt(a*a+b*b-2*a*b*math.cos(angle/180*math.pi)))
import math
from functools import reduce
N,X = map(int,input().split())
u = list(map(int,input().split()))
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
u.append(X)
u.sort()
sa = []
for i in range(len(u)-1):
    sa.append(u[i+1]-u[i])
print(gcd_list(sa))


### FIXED CODE ###

N,X = map(int,input().split())
u = list(map(int,input().split()))
def gcd_list(numbers):
    gct = numbers[0]
    for i in range(len(numbers)-1):
        r = numbers[i+1] % gct
        while r != 0:
            ka = r
            r = gct
            gct = ka
            r = r % gct
    return gct
u.append(X)
u.sort()
sa = []
for i in range(len(u)-1):
    sa.append(u[i+1]-u[i])
if len(sa) > 1:
    print(gcd_list(sa))
else:
    print(sa[0])
n, x = map(int, input().split())
L = [0] + [int(i) for i in input().split()]

c = 0

for i in range(len(l)):
    if sum(L[:i+1]) <= x:
        c += 1
print(c)

### FIXED CODE ###

n, x = input().split()
l = [0] + [int(i) for i in input().split()]
x = int(x)

c = 0

for i in range(len(l)):
    if sum(l[:i+1]) <= x:
        c += 1
print(c)
S = input()

ans = ""

if(S="Sunny")
	print("Cloudy")
else if(S="Rainy")
	print("Sunny")
else
	print("Rainy")

### FIXED CODE ###

S = input()

ans = ""

if S=="Sunny":
	print("Cloudy")
elif S=="Rainy":
	print("Sunny")
else:
	print("Rainy")
S = 46797
s = 46797
a = int(h = (S / 3600), m = ((S % 3600) / 60), for s in range(0, 60) input())
print('a')

### FIXED CODE ###

S = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))
import collections as col
N=int(input())
counts=[]
A=[]
S=[]
T=[]
U=[]
for _ in range(N):
    S.append(input())
T=sorted(S)
s=col.Counter(T)
values, counts = zip(*s.most_common())

print(values[0])
t=1
while counts[t]==counts[t-1]:
    print(values[t])
    t+=1

 

### FIXED CODE ###

N=int(input())
S=[input() for _ in range(N)]

S_d={}
A=[]

for i in range(N):
    if S[i] not in S_d.keys():
        S_d[S[i]]=1
    else:
        S_d[S[i]]+=1

max_co=max(S_d.values())

for j in S_d.keys():
    if S_d[j]==max_co:
        A.append(j)

B=sorted(A)

for k in B:
    print(k)
N = int(input())
S,T = input().stlip

s=""

for i in range(N):
  s+=S[i]+T[i]
print(s)




### FIXED CODE ###

print(6-int(input())-int(input()))
n=int(input())
lists=list(map(int,input().split()))
 
mn=n+1
cnt=0
for li in lists:
  if mn>li:
    mn=li
    cnt+=1
print(cnt)

### FIXED CODE ###

n,m=map(int,input().split())
if n==m:
  print("Yes")
else:
  print("No")
n = int( input() )
a = sorted( list( map( int, input().split())))

import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print( gcd_list(  a ) )

### FIXED CODE ###

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

res = a[0]

while True:
    base = res
    total = 0
    for i in a:
        if  i % base > 0:
            res = min( res, i % base)
        total +=  i % base
    if total == 0:
        break

print(base)
a,s,d=map(int,input().split())
list=list(map(int,input().split()))
c=0
for i in range(a):
  l=list(map(int,input().split()))
  sum=d
  for k in range(s):
    sum+=list[k]*l[k]
  if sum>0:
    c+=1
print(c)
  

### FIXED CODE ###

a,s,d=map(int,input().split())
lis=list(map(int,input().split()))
c=0
for i in range(a):
  l=list(map(int,input().split()))    
  sum=d
  for k in range(s):
    sum+=lis[k]*l[k]
  if sum>0:
    c+=1
print(c)
import sys


def main():
    args = sys.stdin.readline().split()
    N = int(args[0])
    A = map(int, input().split())

    non_factor_cnt = 0
    factor_of_two_cnt = 0
    factor_of_four_cnt = 0
    for num in A:
        remainder = num % 4
        if remainder != 0:
            if remainder == 2:
                factor_of_two_cnt += 1
            else:
                non_factor_cnt += 1
        else:
            factor_of_four_cnt += 1

    if len(A) <= 3 or (len(A) >= 4 and factor_of_four_cnt >= 2):
        if factor_of_four_cnt >= non_factor_cnt - 1:
            print('Yes')
            sys.exit()
    if factor_of_four_cnt >= non_factor_cnt: # + factor_of_two_cnt % 2:
        print('Yes')
        sys.exit()
    print('No')

main()

### FIXED CODE ###

import sys


def main():
    args = sys.stdin.readline().split()
    N = int(args[0])
    A = map(int, input().split())

    non_factor_cnt = 0
    factor_of_two_cnt = 0
    factor_of_four_cnt = 0
    for num in A:
        remainder = num % 4
        if remainder != 0:
            if remainder == 2:
                factor_of_two_cnt += 1
            else:
                non_factor_cnt += 1
        else:
            factor_of_four_cnt += 1

    if factor_of_two_cnt == 0:
        if factor_of_four_cnt >= non_factor_cnt - 1:
            print('Yes')
            sys.exit()
    if factor_of_four_cnt >= non_factor_cnt: # + factor_of_two_cnt % 2:
        print('Yes')
        sys.exit()
    print('No')

main()
n = int(input())
l=[]
for i in range(n): 
    if ((i%3)!=0)  and ((i%5)!=0):
        l.append(i)
print(sum(l))

### FIXED CODE ###

import sys
X=input()
n=len(X)
if n%2==0:
    print("No")
    sys.exit()
ans="No"
def check(s): 
    return s == s[::-1] 
ans="No"
if check(X):
    if check(X[0:int((n-1)/2)]):
        if check(X[int(((n+3)/2)-1):]):
            ans="Yes"
print(ans)
a, b = int(input().split)

if (a*b ) % 2 = 1
    print('odd')
    
    else
    print('even')

### FIXED CODE ###

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

if (a*b ) % 2:
    print('Odd')
    
else:
    print('Even')
import collections
N, K =map(int,input().split())
a=list(map(int,input().split()))
c = collections.Counter(a)
c_=c.most_common()
c__=np.array(c_)
ans=0
for i in range (K,c__.shape[0]):
    ans+=c__[i][1]
print(ans)

### FIXED CODE ###

import collections
import numpy as np
N, K =map(int,input().split())
a=list(map(int,input().split()))
c = collections.Counter(a)
c_=c.most_common()
c__=np.array(c_)
ans=0
for i in range (K,c__.shape[0]):
    ans+=c__[i][1]
print(ans)
X ,N = map(int,input().split())
if N == 0:
    print(X)
else:
    p = list(map(int,input().split()))

    X_u = X - 1
    X_l = X + 1
    while judge:
        X_u += 1
        X_l -= 1
        if X_u not in p and X_l not in p:
            print(X_l)
            break
        elif X_u not in p:
            print(X_u)
            break
        elif X_l not in p:
            print(X_l)
            break
        else:
            if X_u == X_l:
                p.remove(X_u)
            else:
                p.remove(X_u)
                p.remove(X_l)

### FIXED CODE ###

X ,N = map(int,input().split())
if N == 0:
    print(X)
else:
    p = list(map(int,input().split()))

    add_minus = -1
    while True:
        add_minus += 1
        if (X - add_minus) not in p:
            print(X - add_minus)
            break
        elif (X + add_minus) not in p:
            print(X+add_minus)
            break
N = int(input())

if (N>999): print("ABD")
else; print("ABC")

### FIXED CODE ###

N = int(input())

if (N>999): print("ABD")
else: print("ABC")
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for _ in range(n):
  x = input()
  if x == 'AC':
    ac += 1
  elif x == 'WA':
    wa += 1
  elif x == 'TLE':
    tle += 1
  else:
    re += 1
    
print('AC x ', ac)
print('WA x ', waz)
print('TLE x ', tle)
print('RE x ', re)

### FIXED CODE ###

n = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for _ in range(n):
  x = input()
  if x == 'AC':
    ac += 1
  elif x == 'WA':
    wa += 1
  elif x == 'TLE':
    tle += 1
  else:
    re += 1
    
print('AC x ', ac)
print('WA x ', wa)
print('TLE x ', tle)
print('RE x ', re)
# coding: utf-8
N = int(input())
S = {}
for _ in range(N):
    s = input()
    if s not in S:
        S[s] = 0
    S[s] += 1
M = int(input())
for _ in range(M):
    s = input()
    if s not in S:
        S[s] = 0
    S[s] -= 1
print(max(*S.values(), 0))

### FIXED CODE ###

# coding: utf-8
N = int(input())
S = {}
for _ in range(N):
    s = input()
    if s not in S:
        S[s] = 0
    S[s] += 1
M = int(input())
for _ in range(M):
    s = input()
    if s not in S:
        S[s] = 0
    S[s] -= 1
T = list(S.values())
T.append(0)
print(max(T))
n = int(input())
A=list(map(int,input().split()))
cnt=0
import numpy as np
table=np.array([[0]*(n+1) for i in range(n)])
B=[]
C=[]
for i,a in enumerate(A):
    B.append(A[i]+i)
    C.append(A[i]-i)
from collections import Counter
Bd=dict(Counter(B))
Cd=dict(Counter(C))
cnt=0
for k in Bd.keys():
    try:
        cnt+=Bd[k]*Cd[-k]
    except KeyError:
        continue
print(cnt)

### FIXED CODE ###

n = int(input())
A=list(map(int,input().split()))
cnt=0
B=[]
C=[]
for i,a in enumerate(A):
    B.append(A[i]+i)
    C.append(A[i]-i)
from collections import Counter
Bd=dict(Counter(B))
Cd=dict(Counter(C))
cnt=0
for k in Bd.keys():
    try:
        cnt+=Bd[k]*Cd[-k]
    except KeyError:
        continue
print(cnt)
S = input()

cnt = 0
for i in range(S // 2):
  if S[i] != S[len(S) - 1 - i]:
    cnt +=0
print(cnt)
  
  

### FIXED CODE ###

S = input()
 
cnt = 0
for i in range(len(S) // 2):
  if S[i] != S[len(S) - 1 - i]:
    cnt += 1
print(cnt)
r,g,b = input()
if (r*100 + g*10+b) % 4 ==0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

r,g,b = input().split()
if int(r+g+b) % 4 ==0:
  print("YES")
else:
  print("NO")
n = int(input())
a = list(map(int,input().split()))

a_sort = list(sorted(a))
ad = {}
for i in range(len(a_sort)):
    if ad in a_sort[i]:
        ad[a_sort[i]] = ad[a_sort[i]] + 1
    else:
        ad.update(a_sort[i]:1)
ad2 = ad
for key in ad.keys():
    if ad[key] < 2:
        del ad2[key]

amax = max(ad2.keys())
b = ad2
while amax in b:
    b.remove(amax)
bmax = max(b)

if ad2[amax] > 3:
    print(amax*amax)
else:
    print(amax*bmax)

         

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
Adict = {}
for i in A:
    if i in Adict:
        Adict[i]=Adict[i]+1
    else:
        Adict.update({i:1})
B = [0, 0]
for i in Adict.keys():
    if Adict[i] >= 2:
        B.append(i)
    if Adict[i] >= 4:
        B.append(i)
B.sort()
print(B[-1]*B[-2])
if str(input())="SUN":
	print(7)
elif str(input())="MON":
  print(6)
elif str(input())="TUE":
  print(5)
elif str(input())="WED":
  print(4)
elif str(input())="THU":
  print(3)
elif str(input())="FRI":
  print(2)
elif str(input())="SAT":
  print(1)


### FIXED CODE ###

s=input()
if s=='MON':
  print(6)
elif s=='TUE':
  print(5)
elif s=='WED':
  print(4)
elif s=='THU':
  print(3)
elif s=='FRI':
  print(2)
elif s=='SAT':
  print(1)
else:
  print(7)
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = map(int,input().split())
uf = UnionFind(n)
for _ in range(m):
  a,b = map(int,input().split())
  uf.union(a,b)
print(uf.group_count()-1)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m = map(int,input().split())
uf = UnionFind(n)
for _ in range(m):
  a,b = map(int,input().split())
  uf.union(a-1,b-1)
root = [0]*n
for i in range(n):
  root[uf.find(i)] += 1
cnt = 0
for v in root:
  if v!=0:
    cnt += 1
print(cnt-1)
N = int(input())
p_list = [int(s) for s in input.split()]

cnt = 0

for i in range(1,N-1):
  if p_list[i-1] < p_list[i] and p_list[i] < p_list[i+1]
  	cnt += 1

  if p_list[i+1] < p_list[i] and p_list[i] < p_list[i-1]
  	cnt += 1
    
print(cnt)

### FIXED CODE ###

N = int(input())

p_list = [int(s) for s in input().split()]

cnt = 0

for i in range(1,N-1):
  if p_list[i-1] < p_list[i] and p_list[i] < p_list[i+1]:
  	cnt += 1

  if p_list[i+1] < p_list[i] and p_list[i] < p_list[i-1]:
  	cnt += 1

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

A = 10**5
min_idx = 0
for idx in range(N):
  if A[idx] < A[min_idx]:
    min_idx = idx
ans = 0
if (N-idx)%(K-1) == 0:
  ans += (N-idx)//(K-1)
else:
  ans += (N-idx)//(K-1)+1
if idx%(K-1) == 0:
  ans += idx//(K-1)
else:
  ans += idx//(K-1) + 1
print(ans)


### FIXED CODE ###

import math

N, K = map(int, input().split())
nums = list(map(int, input().split()))
print(math.ceil((len(nums)-1)/(K-1)))
v

### FIXED CODE ###

import collections
print(len(collections.Counter(input().split())))
n = int(input())
a = list(map(int, input().split()))

a = sorted(a)
check_minn = 10 ** 10


def check(a, n, check_minn):
    minn = 10 ** 10
    for i in range(1, n):
        if minn > a[i] - a[i - 1] and a[i] - a[i - 1] != 0:
            minn = a[i] - a[i - 1]
    if minn == 10 ** 10:
        return a[0]
    for i in range(n):
        a[i] = a[i] % minn
    a = sorted(list(set(a)))
    n = len(a)
    if a == [0]:
        return minn
    minn = 10 ** 10
    for i in range(n):
        minn = min(minn, a[i])
    if minn == check_minn:
        return minn
    else:
        check_minn = minn
        return check(a, n, check_minn)


print(check(a, n, check_minn))

### FIXED CODE ###

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

if B%A==0:
  print(A+B)
else:
  print(B-A)
a = input()
print (a ** 3)

### FIXED CODE ###

a = int(input())
print (a ** 3)
import math

n = int(input())
result = math.prod([i for i in range(1, n+1)])
print(result%(10**9+7))


### FIXED CODE ###

n = int(input())
result = 1
for i in range(1, n+1):
  result *= i
  result %= 10**9+7
print(result)
import math
a,b = list(map(float, input().split()))
B = int(str(b).replace(".",""))
A = int(A)
print(A*B//100)


### FIXED CODE ###

import math
a,b = input().split()
B = int(str(b).replace(".",""))
A = int(a)
print(A*B//100)
import sys
input = sys.stdin.readline
N = int(input())
X = []
L = []
XL = []
for _ in range(N):
    XL.append([int(x) for x in input().split()])
XL = sorted(XL)
for i in XL:
    X.append(i[0])
    L.append(i[1])
import numpy as np
X = np.array(X, np.int64)
L = np.array(L, np.int64)
XL_max = X + L
XL_min = X - L
A = [0] * N
for i in range(N):
    cnt = 0
    left = sorted(XL_max[:i])
    right = sorted(XL_min[i+1:])
    cnt += i - np.searchsorted(left, XL_min[i], side = "right") 
    cnt += np.searchsorted(right, XL_max[i], side = "left")
    A[i] = cnt
cnt = np.array(sorted(A, reverse=True), np.int64)
cnt = np.cumsum(cnt)
if cnt[-1] == 0:
    print(n)
else:
    print(N - (np.searchsorted(cnt, cnt[-1] // 2) + 1))



### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
XL = []
for _ in range(N):
    tmp = [int(x) for x in input().split()]
    XL.append(tmp)
LR = []
for i in XL:
    LR.append([i[0] - i[1], i[0] + i[1]])
LR.sort()
ans = N
last = LR[0][1]
for i in range(1, N):
    if last > LR[i][0]:
        if last > LR[i][1]:
            last = LR[i][1]
        ans -= 1
    else:
        last = LR[i][1]
print(ans)
from decimal import Decimal
N=int(input())
A=[*map(str,input().split())]
a=Decimal('1')
while A:
  a=a*Decimal(A.pop())
  if a > Decimal('10'**'18'):
    print(-1)
    break
else:
  print(a)

### FIXED CODE ###

N=int(input())
A=[*map(int,input().split())]
a=1
if 0 in A:
  a=0
else:
  while A:
    a*=A.pop()
    if a>10**18:
      a=-1
      break
print(a)
t=list(input())
i=0
if t[i]=="?":
    if t[i+1]=="P":
        t[i]="D"
    else:
        t[i]="P"
for i in range(len(t)-1):
    if t[i]=="?":
        if t[i+1]=="P":
            t[i]="D"
        elif t[i+1]=="D":
            t[i]="P"
        else:
            t[i]="P"
            t[i+1]="D"
if t[-1]=="?":
    t[-1]="D"
print(*t,sep="")

### FIXED CODE ###

t=list(input())
if len(t)==1:
    if t[0]=="?":
        print("D")
    else:
        print(*t)
    exit()
if t[0]=="?":
    if t[1]=="?":
        t[0]="P"
        t[1]="D"
    elif t[1]=="D":
        t[0]="P"
    else:
        t[0]="D"
for i in range(1,len(t)-1):
    if t[i]=="?":
        if t[i-1]=="P":
            t[i]="D"
        elif t[i-1]=="D":
            if t[i+1]=="P":
                t[i]="D"
            else:
                t[i]="P"
if t[-1]=="?":
    t[-1]="D"
print(*t,sep="")
s=input()
s = s.split("/")
if s[0] < 2019:
    print('Heisei')
    break
if s[0] == 2019 and s[0]<= 4:
    print('Heisei')
else:
    print('TBD')

### FIXED CODE ###

s = input()
 
if s <= '2019/04/30':
    print('Heisei')
else:
    print('TBD')
S=list(input())
import string
X= list(string.ascii_lowercase)
for i in list:
    if i not in S:
        print(i)
        break

### FIXED CODE ###

S = input()
for i in range(ord("a"), ord("z")+1):
    if chr(i) not in S:
        print(chr(i))
        break
else:
    print("None")
([int(r) for r in input().split(" ")])-sum([int(r) for r in input().split(" ")])

### FIXED CODE ###

a,b=map(int,input().split())
C=list(map(int,input().split()))
play_day=a-sum(C)
if play_day>=0:
    print(play_day)
else:
    print("-1")
K, S = map(str, input().split())
K = int(K)

print(len(S))
print(K)

print(len(S) >= K)
if len(S) <= K:
    print(S)
else:
    print(S[0:K]+"...")

### FIXED CODE ###

K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    S = S[0:K]+"..."
    print(S)
S = input()
s = list(map(int, S))
t = s.copy()
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in s:
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1

for i in t:
    if t[i+1]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	y +=1
    elif t[i+1]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	y +=1

print(min([x,y]))


### FIXED CODE ###

S = input()
s = list(map(int, S))
t = s.copy()
n = len(s)
x = 0
y = 1

if t[0] == 0:
    t[0]=1
else:
    t[0]=0

for i in range(n-1):
    if s[i+1]==0 and s[i+1] == s[i]:
    	s[i+1]=1
    	x +=1
    elif s[i+1]==1 and s[i+1]==s[i]:
    	s[i+1]=0
    	x +=1
    
for i in range(n-1):
    if t[i+1]==0 and t[i+1] == t[i]:
    	t[i+1]=1
    	y +=1
    elif t[i+1]==1 and t[i+1]==t[i]:
    	t[i+1]=0
    	y +=1

print(min([x,y]))
N,M = map(int,input().split())
MOD = 10**9+7
dp = [0] * (N+1)
dp[1] = 1
dp[2] = 1
for _ in range(M):
  dp[int(input())] = -1

for i in range(N+1):
  if dp[i] == -1: continue
  if i-1>=0 and dp[i-1] != -1:
    dp[i] += dp[i-1]
  if i-2>=0 and dp[i-2] != -1:
    dp[i] += dp[i-2]
  dp[i] %= MOD

print(dp[N])

### FIXED CODE ###

N,M = map(int,input().split())
MOD = 10**9+7
dp = [0] * (N+1)
dp[1] = 1
for _ in range(M):
  dp[int(input())] = -1
if N<2:
  print(dp[N])
  exit()

if dp[2] != -1:
  dp[2] = 1
for i in range(N+1):
  if dp[i] == -1: continue
  if i-1>=0 and dp[i-1] != -1:
    dp[i] += dp[i-1]
  if i-2>=0 and dp[i-2] != -1:
    dp[i] += dp[i-2]
  dp[i] %= MOD

print(dp[N])
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def f(a):
    """
    xor [0,a]
    """
    ans = 0
    l = []
    d = 2
    while (a+1)//d > 0:
        t = (a+1)//d*(d//2)+max((a+1) % d-d//2, 0)
        ans += (t % 2)*(d//2)
        l.append(t % 2)
        d *= 2
    ans += (((a+1)-d) % 2)*(d//2)
    l.append(((a+1)-d) % 2)
    return l


def solve2(a, b):
    rb = f(b)
    ra = f(a-1)
    for i in range(len(ra)):
        rb[i] ^= ra[i]
    ans = "".join(map(str, reversed(rb)))
    print(int(ans, 2))


A, B = map(int, input().split())
if A == 0 and B == 0:
    print(0)
else:
    solve2(A, B)


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


N, M, C = map(int, input().split())
B = list(map(int, input().split()))

cnt = 0
for _ in range(N):
    A = list(map(int, input().split()))
    s = sum([a*b for a, b in zip(A, B)])
    if s+C > 0:
        cnt += 1
print(cnt)
A = int(input())
B = int(input())
T = int(input())
x = T // A
y = B * x
print(y)

### FIXED CODE ###

A,B,T = map(int,input().split())
x = T // A
y = B * x
print(y)
a,b,c,d = map(int, input().split())
l = [a*c, a*d, b*c, b*d]
print(max[l])

### FIXED CODE ###

a,b,c,d = map(int, input().split())
l = [a*c, a*d, b*c, b*d]
print(max(l))
import math
a,b = map(int,input().split())

prime = []
n = max(a,b)
limit = math.sqrt(n)
data = [i+1 for i in range(1,n)]
while True:
    p = data[0]
    if limit<=p:
        prime = prime + data
        break
    prime.append(p)
    data = [e for e in data if e%p != 0]

def divisor(n):
    l = list()
    for i in prime:
        if n==1:
            break
        if n%i==0:
            while n%i==0:
                n//=i
            l.append(i)
    if n!=1 or l==[]:
        l.append(n)
    return l

div = sorted(divisor(a) + divisor(b))
ans = 0
for i in range(len(div)-1):
    if div[i]==div[i+1]:
        ans+=1
print(ans+1)

### FIXED CODE ###

import math
def gcd(a,b):
    if a==0: return b
    return gcd(b%a,a)
def div(n):
    cnt = 0
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
    if temp!=1:
        cnt+=1
    return cnt+1

a,b = map(int,input().split())
print(div(gcd(a,b)))
import math
n=int(input())

l=[4 if i%2==0 else 2 for i in range(n+1)]
l[1]=1
l[2]=2
l[4]=3
for i in range(3,int(math.sqrt(n))+1):
  for j in range(i,n//i+1):
   # print(i,i*j)
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2
#print(l)

l2=[i*l[i] for i in range(n+1)]
print(sum(l2))


### FIXED CODE ###

import math
n=int(input())

l=[4 if i%2==0 else 2 for i in range(max(5,n+1))]
l[1]=1
l[2]=2
l[4]=3
for i in range(3,int(math.sqrt(n))+1):#振るい
  for j in range(i,n//i+1):
   # print(i,i*j)
    if i==j:
      l[i*j]+=1
    else:
      l[i*j]+=2
#print(l)

l2=[i*l[i] for i in range(n+1)]
print(sum(l2))