Harryxun/stf_run huggingface dataset:
mod = 10**9+7

def fac(n):
    fac = [1]*(n+1)
    fac[0] = 1
    fac[1] = 1
    for i in range(1,n+1):
        fac[i] = fac[i-1]*i%mod
    return fac

def main():
    n,m=map(int,input().split(' '))
    fact = fac(n)
    check = 0
    pattern = 1
    a = [0]
    a_list = []
    tmp = -1
    for i in range(m):
        an = int(input())
        a.append(an)
    for i in range(m):
        a_list.append(a[i+1]-a[i]-1)
    a_list.append(n-a[-1]-1)
    if a_list[0] ==0:
        a_list.pop(0)
    for i in a_list:
        tmp = 0
        for j in range(i):
            if i - 2*j >=0:
                tmp +=(fact[(i-j)]/fact[j]/fact[i-2*j])%mod
        pattern *= tmp
        pattern %= mod

    print(int(pattern))

if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    n=list(map(int,input().split(' ')))
    n_sorted = sorted(n)
    print(n_sorted[0]+n_sorted[1])

if __name__=='__main__':
    main()
a=str(raw_input())
b=str(raw_input())
print(a+b)

### FIXED CODE ###

a,b=input().split()
print(b+a)
import collections
n=int(input())

A=list(map(int,input().split())))
B = [(A[0] + A[i] -i)   for i in range(n)]
b = collections.Counter(B)
ans =0
cnt = 0
for i in range(len(B)):
    
    ans += b[cnt]
    if i != 0:
        cnt += (B[i] - B[i-1] -1)

print(ans)

### FIXED CODE ###

import collections
n=int(input())
A=list(map(int,input().split()))
B = [ i-A[i]    for i in range(n)]
C = [ i+A[i]    for i in range(n)]
b = collections.Counter(B)
c = collections.Counter(C)
ans =0
cnt = 0
 
for i in b.keys():
  ans +=c[i]*b[i]
     
print(ans)
W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]

X = [0, W]
Y = [0, H]

for l in lst:
    if l[2] == 1 and X[0] < l[0]:
        X[0] = l[0]
    elif l[2] == 2 and l[0] < X[1]:
        X[1] = l[0]
    elif l[2] == 3 and Y[0] < l[1]:
        Y[0] = l[1]
    elif lst[2] == 4 and l[1] < Y[1]:
        Y[1] = l[1]

width = X[1] - X[0] if X[1] - X[0] > 0 else 0
height = Y[1] - Y[0] if Y[1] - Y[0] > 0 else 0

print(width * height)

### FIXED CODE ###

W, H, N = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(N)]

W_ = [0, W] 
H_ = [0, H]

for l in lst:
    if l[2] == 1 and W_[0] < l[0]:
        W_[0] = l[0]
    elif l[2] == 2 and l[0] < W_[1]:
        W_[1] = l[0]
    elif l[2] == 3 and H_[0] < l[1]:
        H_[0] = l[1]
    elif l[2] == 4 and l[1] < H_[1]:
        H_[1] = l[1]
        
width = W_[1] - W_[0] if W_[1] - W_[0] > 0 else 0
height = H_[1] - H_[0] if H_[1] - H_[0] > 0 else 0

print(width * height)
# coding: utf-8
# Your code here!

import math
import sys

N, M = map(int, input().rstrip().split(' '))
S = [x for x in input()]
T = [x for x in input()]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
L = lcm(N, M)
if S[0] != T[0]:
    print(-1)
    sys.exit()
elif L == N or L == M:
    dp = [-1] * L
    for i, s in enumerate(S):
        dp[i*L//N] = s
        
    for i, t in enumerate(T):
        if dp[i*L//M] != -1 and dp[i*L//M] != t:
            print(-1)
            sys.exit()
else:
    print(L)

### FIXED CODE ###

# coding: utf-8
# Your code here!

import fractions
import sys
from collections import defaultdict

N, M = map(int, input().rstrip().split(' '))
S = [x for x in input()]
T = [x for x in input()]

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

L = lcm(N, M)

dp = defaultdict(lambda: -1)

for i, s in enumerate(S):
    dp[i*L//N] = s

for i, t in enumerate(T):
    if dp[i*L//M] != -1:
        if dp[i*L//M] != t:
            print(-1)
            sys.exit()
print(L)
import sys

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

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

lis = []
dic = {}

i = 1
while i ** N < 10 ** 12:

    flag = True
    for j in lis:
        if i % j == 0:
            flag = False
            break
    
    if flag and i != 1:
        lis.append(i)
        dic[i] = 0

        while P % i == 0:
            P //= i
            dic[i] += 1

    i += 1


ans = 1
#print (dic)

for i in dic:

    if dic[i] != 0:
        ans *= i ** (dic[i]//N)

print (ans)


### FIXED CODE ###

import sys

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

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

lis = []
dic = {}

i = 1
while True:

    flag = True
    now = 1
    if i > 1:
        for j in range(N):
            now *= i
            if now > P:
                flag = False
                break
        if not flag:
            break

    flag = True
    for j in lis:
        if i % j == 0:
            flag = False
            break
    
    if flag and i != 1:
        lis.append(i)
        dic[i] = 0

        while P % i == 0:
            P //= i
            dic[i] += 1

    i += 1


ans = 1
#print (dic)

for i in dic:

    if dic[i] != 0:
        ans *= i ** (dic[i]//N)

print (ans)
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n, m = rli()
	seen = defaultdict(lambda: False)
	G = [[] for _ in range(n+100)]
	for _ in range(m):
		u, v = rli()
		u -= 1
		v -= 1
		u, v = min(u, v), max(u, v)
		if seen[(u, v)]: continue
		seen[(u, v)] = True
		G[u].append(v)
		G[v].append(u)
	sizes = []
	seen2 = defaultdict(lambda: False)
	loc_size = 0
	def dfs(node):
		nonlocal loc_size 
		seen2[node] = True
		loc_size += 1
		for nbhr in G[node]:
			if seen2[nbhr]: continue
			dfs(nbhr)

	for i in range(n):
		if seen[i]: continue
		loc_size = 0
		dfs(i)
		sizes.append(loc_size)
	print(max(sizes))
	stdout.close()

if __name__ == "__main__":
	main()

### FIXED CODE ###

from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n, m = rli()
	seen = defaultdict(lambda: False)
	G = [[] for _ in range(n)]
	for _ in range(m):
		u, v = rli()
		u -= 1
		v -= 1
		u, v = min(u, v), max(u, v)
		if seen[(u, v)]: continue
		seen[(u, v)] = True
		G[u].append(v)
		G[v].append(u)
	sizes = []
	seen2 = defaultdict(lambda: False)
	loc_size = 0
	def dfs(node):
		nonlocal loc_size 
		seen2[node] = True
		loc_size += 1
		for nbhr in G[node]:
			if seen2[nbhr]: continue
			dfs(nbhr)

	for i in range(n):
		if seen[i]: continue
		loc_size = 0
		dfs(i)
		sizes.append(loc_size)
	print(max(sizes))
	stdout.close()

if __name__ == "__main__":
	main()
from math import gcd
x, y = map(int, input().split())
print(gcd(x, y))

### FIXED CODE ###

x, y = map(int, input().split())
while y>0: x, y = y, x%y
print(x)
#include<iostream>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i)
#define rep(i,n) REP(i,0,n)
int main(){
    int K, X;
    cin >> K >> X;
    X -= K - 1;
    rep(i,2*K-1) cout<<X+i<<" ";
    cout<<endl;

    return 0;

}

### FIXED CODE ###

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

T = X - K + 1

ans = []

for i in range(K*2 - 1):
    ans.append(T)
    T += 1

print(' '.join(map(str, ans)))
a,b,c,d=map(int,input().split())
if a+b>c+d:
    print("Left")
elif a+b=c+d:
    print("Balanced")
else:
    print("Right")

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if a+b>c+d:
    print("Left")
elif a+b==c+d:
    print("Balanced")
else:
    print("Right")
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0

def dfs(a, b, k, ans):
  
  if k<=0 or (not a and not b):
    return ans
  
  ans1, ans2 = ans, ans
  if a:
    next_book = a[0]
    if k - next_book >= 0:
      ans1 = dfs(a[1:], b, k - next_book, ans+1)
  if b:
    next_book = b[0]
    if k - next_book >= 0:
      ans2 = dfs(a, b[1:], k - next_book, ans+1)

  return max(ans1, ans2)

print(dfs(a, b, k, 0))

### FIXED CODE ###

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

for i in range(1, n+1):
    a[i] += a[i-1]
for i in range(1, m+1):
    b[i] += b[i - 1]

ans = 0
b_cnt = m
for a_cnt in range(n+1):
    if a[a_cnt] > k:
        continue
    while a[a_cnt] + b[b_cnt] > k:
        b_cnt -= 1
    ans = max(ans, a_cnt + b_cnt)
print(ans)
a, b = map(int, input().split())
print(int(a*b))

### FIXED CODE ###

a, b = input().split()
a = int(a)
b = int(b[0] + b[2:])
print(a*b//100)
a = int(input())
b = int(input())

x = (a + b) // 2
y = (a + b) % 2
if y != 0 :
    print(str(x + 1))
else      :
    print(str(x))


### FIXED CODE ###

num = input().split(" ")
a = int(num[0])
b = int(num[1])

x = (a + b) // 2
y = (a + b) % 2
if y != 0 :
    print(str(x + 1))
else      :
    print(str(x))
a = int(input())
s = input()

if a => 3200:
    print(s)
else:
    print("red")

### FIXED CODE ###

a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")
a,b=input().split()
n=int(a)/2
s=b
if n % 2:
  print('No')
elif s[n:]!=s[:n]:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

n = int(input())
s = input()
if n % 2:
    print("No")
    exit()
half = s[0:n // 2]
print("Yes" if s == half + half else "No")
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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 LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    a = LI()
    a.sort()
    l = 0
    r = 2*a[-1]
    while r-l > 1:
        x = (l+r) >> 1
        s = 0
        for i in a:
            j = bisect.bisect_left(a,x-i)
            s += n-j
        if s <= m:
            r = x
        else:
            l = x
    s = [0]*n
    s[-1] = a[-1]
    for i in range(n-1)[::-1]:
        s[i] = s[i+1]+a[i]
    res = m
    ans = 0
    for i in a:
        j = bisect.bisect_left(a,r-i)
        if j < n:
            ans += min(res,(n-j))*i
            if res < n-j:
                j = n-res
            ans += s[j]
            res -= n-j
            if res < 0:
                res = 0
    print(ans+res*l)
    return

#Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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 LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    a = LI()
    a.sort()
    l = 0
    r = 2*a[-1]
    while r-l > 1:
        x = (l+r) >> 1
        s = 0
        for i in a:
            j = bisect.bisect_left(a,x-i)
            s += n-j
        if s <= m:
            r = x
        else:
            l = x
    s = [0]*n
    s[-1] = a[-1]
    for i in range(n-1)[::-1]:
        s[i] = s[i+1]+a[i]
    res = m
    ans = 0
    for i in a:
        j = bisect.bisect_left(a,r-i)
        if res < n-j:
            j = n-res
        if j < n:
            ans += min(res,(n-j))*i
            ans += s[j]
            res -= n-j
            if res < 0:
                res = 0
    print(ans+res*l)
    return

#Solve
if __name__ == "__main__":
    solve()
a, b, c = map(int, input().split())

if a+b >= c
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

if a+b >= c:
    print("Yes")
else:
    print("No")
import sys

def odd_def(num):
    if num % 2 == 0:
        return False
    else:
        return True

def main():
    a,b = map(int, input().split())
    for i in range(1,4):
        mal = a*b*c
        if odd_def(mal):
            print('Yes')
            sys.exit()
    print('No')


if __name__ == '__main__' :
    main()

### FIXED CODE ###

def main():
    l = list(map(int,input().split()))
    l = sorted(l,reverse=True)
    ans = ''

    for i in range(0,len(l)-1):
        ans = ans + str(l[i])
    ans_int = int(ans) + int(l[-1])

    print(ans_int)




if __name__ == '__main__' :
    main()
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
i,j=0,0
m1=[]
for k in a:
  if b[i]>k:
    j+=1
  else:
    m1.append(j)
for t in range(len(m1),len(b)):
  m1.append(j)
i,j=0,0
m2=[]
for k in range(n):
  if c[i]>k:
    j+=m1[b[k]]
  else:
    m2.append(j)
for t in range(len(m2),len(c)):
  m2.append(j)
print(sum(m2))


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
i,j,k=0,0,0
m1=[]
while k<n and i<n:
  if b[i]>a[k]:
    j+=1
    k+=1
  else:
    m1.append(j)
    i+=1
for t in range(len(m1),len(b)):
  m1.append(j)
i,j,k=0,0,0
m2=[]
while k<n and i<n:
  if c[i]>b[k]:
    j+=m1[k]
    k+=1
  else:
    m2.append(j)
    i+=1
for t in range(len(m2),len(c)):
  m2.append(j)
print(sum(m2))
N, M = map(int, input().split())

#AB = [tuple(map(int, input().split())) for i in range(M)]
#丸暗記。隣接リストの初期化
graph = [[i+1] for i in range(M)]

for _ in range(M):
  a, b = map(int, input().split())
  graph[a-1].append(b)
  graph[b-1].append(a)

ans = -1
for g in graph:
  ans = max(ans, len(set(g)))
print(ans)


### FIXED CODE ###

N, M = map(int, input().split())
AB = [tuple(map(int,input().split())) for i in range(M)]

class UnionFind:
    def __init__(self,N):
        self.parent = [i for i in range(N)]
        self._size = [1] * N
        self.count = 0

    def root(self,a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]
    def is_same(self,a,b):
        return self.root(a) == self.root(b)

    def unite(self,a,b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self._size[ra] < self._size[rb]: ra,rb = rb,ra
        self._size[ra] += self._size[rb]
        self.parent[rb] = ra
        self.count += 1

    def size(self,a):
        return self._size[self.root(a)]

uf = UnionFind(N)
for a,b in AB:
    a,b = a-1,b-1
    if uf.is_same(a,b): continue
    uf.unite(a,b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))
print(ans)
N = int(input())
A = list(map(int,input().split()))
result = 0
for i in range(N-1):
  if A[i] == A[i+1]:
    result += 1
    if A[i+2]!=A[i+1] :
      A[i+1] = abs(A[i+2]-A[i+1])
    elif A[i+2]==A[i+1] and A[i+1]==1:
      A[i+1] = 2
    else:
      A[i+1] = 1
print(result)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N-1):
  if A[i] == A[i+1]:
    A[i+1] = -1
    ans += 1
print(ans)
s = input()
t = "AKIHABARA"
idx = 0
ok = 1
for i in range(len(s)):
    if s[i] == t[idx]:
        idx += 1
    elif s[i] != 'A' and t[idx] == 'A':
        idx += 1
        if s[i] == t[idx]:
            idx += 1
        else:
            ok = 0
    elif idx == len(t):
        ok = 0
        break
    else:
        ok = 0
print("YES"*ok or "NO")


### FIXED CODE ###

s = input()
t = "AKIHABARA"
idx = 0
ok = 1
for i in range(len(s)):
    if idx == len(t):
        ok = 0
        break
    if s[i] == t[idx]:
        idx += 1
    elif s[i] != 'A' and t[idx] == 'A':
        idx += 1
        if idx < len(t) and s[i] == t[idx]:
            idx += 1
        else:
            ok = 0
    else:
        ok = 0
if idx != len(t) and idx != len(t)-1:
    ok = 0
print("YES"*ok or "NO")
#!/usr/bin/python

input_data = input().split()

d1 = input_data[0]
d2 = input_data[1]
d3 = input_data[2]
total = 0

d4 = d2 % d1
if d4 > d3:
    total += 1

print(total)

### FIXED CODE ###

#!/usr/bin/python

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

d1 = input_data[0]
d2 = input_data[1]
d3 = input_data[2]

d4 = int(d2 / d1)
if d4 > d3:
    total = d3
else:
    total = d4

print(total)
import math
a,b=map(int,input().split())
print(int(a*b/math.gcd(a,b)))

### FIXED CODE ###

import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
A, B = map(int , input().split())
print(lcm(A, B))
#dojkstra
import itertools
import queue
G=[]
#infの値に注意
inf=3*10**15
V, E, R=map(int,input().strip().split(' '))
rlis=list(map(int,input().strip().split(' ')))

cost=[[inf]*V for i in range(V)]
for i in range(E):
    fr, to, co=map(int,input().strip().split(' '))
    cost[fr-1][to-1]=co
    cost[to-1][fr-1]=co
def dijkstra(s):
    d=[inf]*V
    used=[False]*V
    d[s]=0
    while True:
        v=-1
        for u in range(V):
            if used[u]==False and(v==-1 or d[u]<d[v]):
                v=u
        if v==-1:
            break
        used[v]=True
        for u in range(V):
            d[u]=min(d[u],d[v]+cost[v][u])
    return d

dist=[]
for i in range(V):
    dist.append(dijkstra(i))

rperm=n_perm(rlis)

ans=inf
for rperm in itertools.permutations(rlis):
    a_tmp=0
    for j in range(R-1):
        a_tmp+=dist[rperm[j]-1][rperm[j+1]-1]
    ans=min(ans,a_tmp)
    
print(ans)



### FIXED CODE ###

import sys
input = sys.stdin.readline

#dojkstra
import itertools
import queue
G=[]
#infの値に注意
inf=3*10**15
V, E, R=map(int,input().strip().split(' '))
rlis=list(map(int,input().strip().split(' ')))

cost=[[inf]*V for i in range(V)]
for i in range(E):
    fr, to, co=map(int,input().strip().split(' '))
    cost[fr-1][to-1]=co
    cost[to-1][fr-1]=co
def dijkstra(s):
    d=[inf]*V
    used=[False]*V
    d[s]=0
    while True:
        v=-1
        for u in range(V):
            if used[u]==False and(v==-1 or d[u]<d[v]):
                v=u
        if v==-1:
            break
        used[v]=True
        for u in range(V):
            d[u]=min(d[u],d[v]+cost[v][u])
    return d

dist=[None] * V
for i in rlis:
    dist[i-1]=dijkstra(i-1)

ans=inf
for rperm in itertools.permutations(rlis):
    a_tmp=0
    for j in range(R-1):
        a_tmp+=dist[rperm[j]-1][rperm[j+1]-1]
    ans=min(ans,a_tmp)

print(ans)
import sys
input = sys.stdin.readline

def judge(x):
    cnt = 0
    
    for Ai in A:
        cnt += (Ai+x-1)//x-1
    
    return cnt<=K

def binary_search():
    l, r = 0, 10**9+100
    
    while l<=r:
        m = (l+r)//2
        
        if judge(m):
            r = m-1
        else:
            l = m+1
    
    return l

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

### FIXED CODE ###

import sys
input = sys.stdin.readline

def judge(x):
    cnt = 0
    
    for Ai in A:
        cnt += (Ai+x-1)//x-1
    
    return cnt<=K

def binary_search():
    l, r = 1, 10**9+100
    
    while l<=r:
        m = (l+r)//2
        
        if judge(m):
            r = m-1
        else:
            l = m+1
    
    return l

N, K = map(int, input().split())
A = list(map(int, input().split()))
print(binary_search())
import math

a, b = map(int, input().split())
print(int(a*b/math.gcd(a, b)))


### FIXED CODE ###

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


a, b = map(int, input().split())
if a < b:
    save = a
    a = b
    b = save
print(int(a*b/gcd(a, b)))
a = int(input())
b = int(input())
c = int(input())

if a == b and b == c:
    print(1)
elif a == b or b == c or a == c:
    print(2)
else:
    print(3)


### FIXED CODE ###

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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)
n=int(input())
if s[-1]=2 and s[-1]=4 and s[-1]=5 and s[-1]=7 and s[-1]=9:
    print('hon')
elif s[-1]=0 and s[-1]=1 and s[-1]=6 and s[-1]=8
    print('pon')
else:
    print('bon')

### FIXED CODE ###

s=input()
if s[-1]=='3':
  print('bon')
elif s[-1] in ['0','1','6','8']:
  print('pon')
else:
  print('hon')
def main():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]
    a = set(a)

    s[0] = 1
    s[1] = 1 if 1 not in a else 0

    for i in range(2, n+1):
        if i in a:
            continue
        s[i] = (s[i-1] + s[i-2]) % 1000000007

    print(s[n])

main()

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    if m != 0:
        a = [int(input()) for _ in range(m)]
        a = set(a)
    else:
        a = set()
    
    s = [0] * (n+1)
    s[0] = 1
    s[1] = 1 if 1 not in a else 0

    for i in range(2, n+1):
        if i in a:
            continue
        s[i] = (s[i-1] + s[i-2]) % 1000000007

    print(s[n])

main()
N=int( input())
a=list(set([int(j) for j in range(N)]))
print(a[::2]-a[1::2])

### FIXED CODE ###

N=input()
a= sorted([int(j) for j in input().split()],reverse=True)
print(sum(a[::2])-sum(a[1::2]))
N = int(input())
HIGH = [int(x) for x in input().split()]
LOW = [int(x) for x in input().split()]

def get_sum(diff_list):
    max_abs_value = max(diff_list, key=abs)
    max_abs_index = diff_list.index(max_abs_value)
    
    down_index = max_abs_index if max_abs_value >= 0 else max_abs_index - 1
    corrects = [HIGH[i] if i <= down_index else LOW[i] for i, _ in enumerate(diff_list)]
    return sum(corrects)

def main():
    first = HIGH.pop(0)
    last = LOW.pop()
    diff_list = []
    high = low = 0
    for i in range(N - 1):
        high = high + HIGH[i]
        low = low + LOW[i]
        diff_list.append(high - low)

    sum = get_sum(diff_list) if len(diff_list) != 0 else 0
    result = first + sum + last
    print(result)

if __name__ == "__main__":
    main()

### FIXED CODE ###

X = int(input())
A = int(input())
B = int(input())

def main():
    m = X - A
    while m - B >= 0:
        m = m - B
    print(m)

if __name__ == "__main__":
    main()
from functools import reduce
from math import gcd

N, X = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]

def main():
    ds = list(map(lambda n: abs(X - n), P))
    # ans = reduce(lambda a, b: gcd(a, b), ds)
    d = min(ds)
    while d > 0:
        if all(map(lambda distance: distance % d == 0, ds)) == True:
            break
        d = d - 1
    ans = d
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from functools import reduce
from fractions import gcd

N, X = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]

def main():
    ds = list(map(lambda n: abs(X - n), P))
    ans = reduce(lambda a, b: gcd(a, b), ds)
    print(ans)

if __name__ == "__main__":
    main()