Harryxun/stf_run huggingface dataset:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math

N,D = map(int, sys.stdin.readline().rstrip().split())
ds = map(int, sys.stdin.readline().rstrip().split())
Q, = map(int, sys.stdin.readline().rstrip().split())
qs = map(int, sys.stdin.readline().rstrip().split())
qs.sort()


targets = [1]
for d in reversed(ds):
    if(d//2 < targets[-1]):
        targets.append(targets[-1] + d)
    else:
        targets.append(targets[-1])
targets.reverse()

current = D
can_avoids = []
for i in range(N):
    d = ds[i]
    target = targets[i+1]
    #print("current:", current)
    can_avoids.append(current >= target)
    if d//2 < current:
        current -= d
        current = max(-current, current)

#print(targets)
#print(can_avoids)

for q in qs:
    if (can_avoids[q-1]):
        print("YES")
    else:
        print("NO")


exit(0)


### FIXED CODE ###

#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math

N,D = map(int, sys.stdin.readline().rstrip().split())
ds = list(map(int, sys.stdin.readline().rstrip().split()))
Q, = map(int, sys.stdin.readline().rstrip().split())
qs = list(map(int, sys.stdin.readline().rstrip().split()))


targets = [1]
for d in reversed(ds):
    if(d//2 < targets[-1]):
        targets.append(targets[-1] + d)
    else:
        targets.append(targets[-1])
targets.reverse()

current = D
can_avoids = []
for i in range(N):
    d = ds[i]
    target = targets[i+1]
    #print("current:", current)
    can_avoids.append(current >= target)
    if d//2 < current:
        current -= d
        current = max(-current, current)

#print(targets)
#print(can_avoids)

for q in qs:
    if (can_avoids[q-1]):
        print("YES")
    else:
        print("NO")


exit(0)
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,c = input().split()
if b == +:
    print(int(a + c))
else:
    print(int(a - c))

### FIXED CODE ###

n = input().split()
if n[1] == '+':
    print(int(n[0])+int(n[2]))
else:
    print(int(n[0])-int(n[2]))
x,y=map(int,input().split())
ttl=0
if x>3 and y>3:
  #do nothing
else:
  for i in range(1,4):
    ttl=(4-i)*100000
    for j in range(1,4):
    	ttl=ttl+(4-j)*100000
        break
  if ttl==600000:
    ttl=ttl+400000
print(ttl)

### FIXED CODE ###

x,y=map(int,input().split())

ttl=0
if(x>3 and y>3):
  ttl=0
else:
  for i in range(1,4):
    if i==x:
        ttl=(4-i)*100000
        break
  for j in range(1,4):
    if j==y:
        ttl=ttl+(4-j)*100000
        break
  if ttl==600000:
    ttl=ttl+400000
print(ttl)
S = input()
T = input()
U = T[：-1]
if S == U:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = input()
T = input()
U = T[:-1]
if S == U:
  print("Yes")
else:
  print("No")
while True:
    data = int(input())
    if data == '0':
        break

    print(sum([str(i) for i in data]))

### FIXED CODE ###

while True:
    data = input()
    if data == '0':
        break
 
    print(sum([int(i) for i in data]))
import math

print(math.floor(N / 2) + 1 if N % 2 else math.floor(N / 2))

### FIXED CODE ###

import math

def func(N):
    ans = math.floor(N / 2) + 1 if N % 2 else math.floor(N / 2)
    return ans
  
  
N = int(input())

print(func(N))
N,M = map(int,input().split())
num =0
line_m=[]
line_s=[]
for k in range(M):
    line_m.append(0)
for i in range(N):
    line_s = list(map(int, input().split()))
    for n in range(int(line_s[0])):
        line_m[int(line_s[n])] = int(line_m[int(line_s[n])]) + 1

for s in range(M):
    if line_m[s] == N:
        num = num+1

print(num)
        

### FIXED CODE ###

N,M = map(int,input().split())
num =0
line_m=[]
line_s=[]
for k in range(M+1):
    line_m.append(0)
for i in range(N):
    line_s = list(map(int, input().split()))
    for n in range(int(line_s[0])):
        line_m[int(line_s[n+1])] = int(line_m[int(line_s[n+1])]) + 1

for s in range(M+1):
    if line_m[s] == N:
        num = num+1

# print(line_s)
# print(line_m)

print(num)
N, M = map(int, input().split())
L = 0
R = 0
for _ in range(M):
    inp = input().split()
    l = int(inp[0])
    r = int(inp[1])
    L = max(L,l)
    R = min(R,r)
print(max(0,min(R,N) + 1 - L))

### FIXED CODE ###

#1226
import math
A, B = map(int, input().split())
print(math.floor(B if A > 12 else B/2 if A > 5 else 0))
n,m=map(int,input().split()):
  if n==m
  print(yes)
  else n!=m
  print(no)
  

### FIXED CODE ###

N,M=map(int,input().split())
if N==M:
  print("Yes")
else:
  print("No")
import math
print(2**math.floor(math.log2(int(input()))))

### FIXED CODE ###

import math
print(2**math.floor(math.log(int(input()))/math.log(2)))
import math

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

def andiv(A,N): #N以下でAで割り切れないものの数
    return((N//A)*(A-1)+N%A)

def lcm(a,b): #最小公倍数
    return(int((a*b / math.gcd(a,b))))

E = andiv(C,B) + andiv(D,B) - andiv(lcm(C,D),B)
F = andiv(C,A-1) + andiv(D,A-1) - andiv(lcm(C,D),A-1)

print(E-F)


### FIXED CODE ###

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

def andiv(M,N):
    return((N//M) * (M-1) + N%M)

def gcd(a,b):
    while b!=0:
        a,b = b,a%b
    return a

def lcm(a,b):
    return(a*b // gcd(a,b))

E = andiv(C,B) + andiv(D,B) - andiv(lcm(C,D),B)
F = andiv(C,A-1) + andiv(D,A-1) - andiv(lcm(C,D),A-1)

print(int(E-F))
import math

a, b, h, m = map(int, input())
angle = 30*h - 6*m
if(angle >= 180):
  angle = 360 - angle

print(a**2+b**2-2*a*b*math.cos(angle))

### FIXED CODE ###

import math

a, b, h, m = map(int, input().split())
angle = 30*h - 5.5*m
if(angle >= 180):
  angle = 360 - angle
print((a**2+b**2-(2*a*b*math.cos(math.radians(angle))))**0.5)
import math

def main():
    data_num, max_num_10 = list(map(int, input().split()))
    data = list(map(int, input().split()))

    max_num_2 = bin(max_num_10)[2:]
    ketasuu = len(max_num_2)

    max_ketasuu = ketasuu
    for point_10 in data:
        point_2 = bin(point_10)[2:]
        if max_ketasuu < len(point_2):
            max_ketasuu = len(point_2)

    keta_count = [0 for i in range(max_ketasuu)]

    for point_10 in data:
        point_2 = bin(point_10)[2:][::-1]
        # print(point_2)
        for i in range(len(point_2)):
            if point_2[i] == '1':
                    keta_count[i] += 1
        # print(keta_count)

    ans = ''
    for i in range(ketasuu):
        if keta_count[i] >= math.ceil(data_num / 2):
            ans += '0'
        else:
            ans += '1'
    ans = ans[::-1]

    # asn = '1100'
    # max_num_2 = '1001'
    # ketasuu = 4


    if max_num_10 < int(ans, 2):
        # print('yyy')
        count = 1
        for i in range(ketasuu)[::-1]:
            if ans[i] == '1' and max_num_2[i] == '0':
                # print('uyt', count)
                if max_num_10 >= int(ans, 2) - count:
                    # print('uuuuu')
                    # print(ans)
                    ans = list(ans)
                    # print(ans)
                    ans[i] = '0'
                    # print(ans)
                    ans = ''.join(ans)
                    # print(ans)
                    break
        if max_num_10 < int(ans, 2)
            ans = list(ans)
            # print(ans)
            ans[0] = '0'
            # print(ans)
            ans = ''.join(ans)
            # count *= 2

    ans = ans[::-1]

    ans_count = 0
    now_point = 1

    for i in range(max_ketasuu):
        if i >= ketasuu:
            count_number = keta_count[i]
        else:
            if ans[i] == '1':
                count_number = data_num - keta_count[i]
            else:
                count_number = keta_count[i]
            # print(ans_count, now_point, count_number)
        ans_count += now_point * count_number
        now_point *= 2

    print(ans_count)

def test():
    ans = '1110'
    max_num_2 = '1011'
    ketasuu = 4
    max_num_10 = 11

    if max_num_10 < int(ans, 2):
        # print('yyy')
        count = 1
        for i in range(ketasuu)[::-1]:
            if ans[i] == '1' and max_num_2[i] == '0':
                print('uyt', count)
                if max_num_10 >= int(ans, 2) - count:
                    print('uuuuu')
                    # print(ans)
                    ans = list(ans)
                    # print(ans)
                    ans[i] = '0'
                    # print(ans)
                    ans = ''.join(ans)
                    # print(ans)
                    break
            count *= 2

    # ans = ans[::-1]
    print(ans)

if __name__ == '__main__':
    main()
    # test()


### FIXED CODE ###

a, b = list(map(int, input().split()))
print(a/b)
s=input()
counter=0
if s[0]=1:
    counter+=1
if s[1]=1:
    counter+=1
if s[2]=1:
    counter+=1
print(counter)

### FIXED CODE ###


s=input()
list0=["000"]
list1=["100","010","001"]
list2=["110","101","011"]
list3=["111"]
if s in list0:
    print(0)
if s in list1:
    print(1)
if s in list2:
    print(2)
if s in list3:
    print(3)
import sys
N = int(input())
r = list(map(int, input().split()))
if min(r) >= 3200:
  print(str(1)+' '+str(N))
  sys.exit()
li = [0 for i in range(9)]
for rates in r:
  n = rates//400
  li[n] += 1
p = 0
for nums in li[0:8]:
  if nums !=0:
    p += 1
print(str(p)+' '+str(p+li[8]))

### FIXED CODE ###

import sys
N = int(input())
r = list(map(int, input().split()))
if min(r) >= 3200:
  print(str(1)+' '+str(N))
  sys.exit()
li = [0 for i in range(9)]
for rates in r:
  if rates >= 3200:
    rates = 3200
  n = rates//400
  li[n] += 1
p = 0
for nums in li[0:8]:
  if nums !=0:
    p += 1
print(str(p)+' '+str(p+li[8]))
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]

d = [[-1] * W for _ in range(H)]
def dfs(x, y):
    stack = [(x, y)]
    d[x][y] = 1
    while stack:
        x, y = stack.pop()
        next_ = [(x + 1, y + 1), (x + 1, y - 1), (x - 1, y + 1), (x - 1, y - 1)]
        for i in next_:
            nx, ny = i
            if 0 <= nx < H and 0 <= ny < W and d[nx][ny] < 0:
                stack.append((nx, ny))
                d[nx][ny] = 1
    return d

d = dfs(0, 0)
cnt = 0
for i in d:
    for j in i:
        if j == 1:
            cnt += 1

print(cnt)

### FIXED CODE ###

import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().split()]
ans = 0

if H == 1 and W == 1:
    print(1)
    sys.exit()

if H == 1 or W == 1:
    print(1)
    sys.exit()

# type2
b = H // 2

# type1
a = H - b

ans += b * (W // 2)
ans += a * (W - (W // 2))

print(ans)
X, A = map(int, input().split())
if X < A:
    print(str(0)
else:
    print(str(10))


### FIXED CODE ###

X, A = map(int, input().split())
if X < A:
    print(str(0))
else:
    print(str(10))
import numpy as np
A = int(input())

if A >= 3000:
    print(1)
else:
    a = [100,101,102,103,104,105]  
    N = A//100
    dp = np.array([np.array([0 for i in range(A+1)]) for j in range(N+1)])
    dp[0][0] = 1
        
    for i in range(N):
        for j in np.where(dp[i] == 1)[0]:
        #for j in range(A+1):
           # if dp[i][j] == 1:
            dp[i+1][j+100:j+106] = 1
    
    print(dp[N][A])
    
    
    dp = [[0 for i in range(A+1)] for j in range(N+1)]
    dp[0][0] = 1
    
    for i in range(N):
        for j in range(A+1):
            if a[i] <= j:
                dp[i+1][j] = dp[i][j-a[i]] or dp[i][j]
            else:
                dp[i+1][j] = dp[i][j]
    
    print(dp[N][A])

### FIXED CODE ###

import numpy as np
A = int(input())

if A >= 3000:
    print(1)
else:
    a = [100,101,102,103,104,105]
    N = A//100
    dp = np.array([np.array([0 for i in range(A+1)]) for j in range(N+1)])
    dp[0][0] = 1

    for i in range(N):
        for j in np.where(dp[i] == 1)[0]:
        #for j in range(A+1):
           # if dp[i][j] == 1:
            dp[i+1][j+100:j+106] = 1
    print(dp[N][A])
days = int(input())
vals = [int(x) for x in input().split()]
has = 1000
for i in range(days - 1)
    if vals[i] <= vals[i+1]:
        can, has = divmod(has, vals[i])
        has += can * (vals[i+1])
return has        
       


### FIXED CODE ###

days = int(input())
vals = [int(x) for x in input().split()]
has = 1000
for i in range(days - 1):
    if vals[i] <= vals[i+1]:
        can, has = divmod(has, vals[i])
        has += can * (vals[i+1])
print(has)
r = (int)input().split()
import math
d = r * r * math.pi
l = 2 * r * math.pi
print("%f %f" %(d,l))

### FIXED CODE ###

r = float(input())
import math
d = r * r * math.pi
l = 2 * r * math.pi
print("%f %f" %(d,l))
from sys import stdin
input = stdin.readline
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()))
red = sorted(p)
green = sorted(q)
no = sorted(r)
red.reverse()
green.reverse()
no.reverse()

c_r = 0
c_g = 0
c_n = 0
ans = 0

while (c_r < X) and (c_g < Y) and (c_n < C):
  tmp = min(red[X-c_r-1],green[Y-c_g-1])
  if tmp > no[c_n]:
    break
  else:
    ans += no[c_n]
    c_n += 1
    if red[X-c_r] > green[Y-c_g]:
      c_g += 1
    else:
      c_r += 1

if c_r == X:
  while (c_n < C) and (c_g < Y):
    if green[c_g] > no[c_n] :
      break
    else:
      ans += no[c_n]
      c_g += 1
      c_n += 1
elif c_g == Y:
  while (c_n < C) and (c_r < X):
    if red[c_r] > no[c_n] :
      break
    else:
      ans += no[c_n]
      c_r += 1
      c_n += 1

if c_r != X:
  ans += sum(red[0:X-c_r])
if c_g != Y:
  ans += sum(green[0:Y-c_g])
print(ans)

### 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()
p.reverse()
q.sort()
q.reverse()
new = p[0:X] + q[0:Y] + r
new.sort()
new.reverse()
print(sum(new[0:X+Y]))
import defaultdict from collections

d = defaultdict([])
goal, n = map(int, input().split())
for _ in range(n):
  from, to = map(int, input().split())
  d[from].append(to)
  d[to].append(from)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

from collections import defaultdict

d = defaultdict(list)
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")
N,M=map(int,input().split())

G=[[] for _ in range(N+1)]  #G[0]はダミー
for edge in range(M):
    x,y=map(int,input().split())
    G[x].append(y)

DP=[-1]*(N+1)   #DP[0]はダミー

def rec(now):
    global G

    if DP[now]!=-1:
        return DP[now]

    else:
        res=0
        for next in G[now]:
            res=max(res,rec(next)+1)
        DP[now]=res
        return res

ans=0
for v in range(1,N+1):
    ans=max(ans,rec(v))

print(ans)



### FIXED CODE ###

S=str(input())
T=str(input())

ls=len(S)
lt=len(T)


DP=[[0]*(lt+1) for _ in range(ls+1)]


for i in range(1,ls+1):
    for j in range(1,lt+1):
        if S[i-1]==T[j-1]:
            DP[i][j]=max(DP[i-1][j-1]+1,DP[i][j-1],DP[i-1][j])
        else:
            DP[i][j]=max(DP[i][j-1],DP[i-1][j])

lf=DP[ls][lt]

res=''
u=ls
v=lt
while u>0 and v>0:
    if DP[u][v]==DP[u-1][v]:
        u-=1
    elif DP[u][v]==DP[u][v-1]:
        v-=1
    else:
        res=S[u-1]+res
        u-=1
        v-=1

print(res)
import math
a = [int(input()) for i in range(5)]
sum = 0
r =[]
for i in range(5):
  if a[i] % 10 ==0:
    sum+=a[i]
  elif a[i] % 10 !=0:
    r.append(a[i]%10)
    sum+= (10*math.ceil(a[i]/10))
print(sum-10+min(r))

### FIXED CODE ###

import math
a = []
for i in range(5):
    a.append(int(input()))
sum = 0
r =10
for i in range(5):
  if a[i] % 10 ==0:
    sum+=a[i]
  elif a[i] % 10 !=0:
    r = min(r,a[i]%10)
    sum+= (10*math.ceil(a[i]/10))
print(sum-10+r)
N = int(input())
dp = [0] * (1 << N)
dp[0] = 1
MOD = 10 ** 9 + 7
now = {0}
for _ in range(N):
    mat = [1<<i for i, v in enumerate(input().split()) if v == '1']
    nxt = set()
    for k in now:
        p = dp[k] % MOD
        for m in mat:
            if k & m: # 1101 & 0100 3番目の人はすでにペアになっているためはじく
                continue
            dp[k | m] += p # 1001 | 0010 = 1101
            nxt.add(k | m)
    now = nxt
print(dp[-1] % MOD) #dp[11...11]が答えになる

### FIXED CODE ###

N = int(input())
dp = [0] * (1 << N)
dp[0] = 1
MOD = 10 ** 9 + 7
now = {0}
for _ in range(N):
    mat = [1<<i for i, v in enumerate(input().split()) if v == '1']
    nxt = set()
    for k in now:
        p = dp[k] % MOD
        for m in mat:
            if k & m: # 1101 & 0100 3番目の人はすでにペアになっているためはじく
                continue
            dp[k | m] += p # 1001 | 0010 = 1101
            nxt.add(k | m)
    now = nxt
print(dp[-1] % MOD) #dp[11...11]が答えになる
N=int(input())
hats=input()
 
red=0
for hat in range(len(hats)):
   if hat=="R":
      red++
 
if red>N-red:
   print("Yes")
else:
   print("No")

### FIXED CODE ###

N=int(input())
hats=input()
 
red=0
for hat in hats:
   if hat=="R":
      red=red+1
 
if red>N-red:
   print("Yes")
else:
   print("No")
a,b,k = map(int, input().split())
if a <= K:
  a = 0
  k = k - a
  b -= k
  if b < 0:
    b = 0
  else:
    pass
else:
  a -= k
print(a, b)

### FIXED CODE ###

a,b,k = map(int, input().split())
if a <= k:
  k = k - a
  a = 0
  b = b - k
  if b < 0:
    b = 0
  else:
    pass
else:
  a -= k
print(a, b)
def resolve():
    s = input()
    t = input()
    ls = len(s)
    lt = len(t)
    c = []
    for i in range(ls - lt):
        count = 0
        for j in range(lt):
            if s[i+j] == t[j]:
                count += 1
        c.append(count)
    print(lt - max(c))
resolve()    

### FIXED CODE ###

def resolve():
    s = input()
    t = input()
    ls = len(s)
    lt = len(t)
    c = []
    for i in range(ls - lt + 1):
        count = 0
        for j in range(lt):
            if s[i+j] == t[j]:
                count += 1
        c.append(count)
    print(lt - max(c))
resolve()
n = int(input())
a = list(map(int,input().split()))
total=0
for i in a:
  total += 1/a
print(1/total)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
total=0
for i in a:
  total += 1/i
print(1/total)
n,m = map(int,input().split())
X = [list(map(int,input().split())) for i in range(n)]
res = 0
for (a,b,c) in product([-1,1],[-1,1],[-1,1]):
    tmp=[]
    for x,y,z in X:
        tmp.append(a*x+b*y+c*z)
    tmp.sort(reverse=True)
    res = max(res,sum(tmp[:m]))

print(res)


### FIXED CODE ###

N,M = map(int,input().split())
x=[]
y=[]
z=[]
for i in range(N):
    xi,yi,zi = map(int,input().split())
    x.append(xi)
    y.append(yi)
    z.append(zi)
ppp =[]
ppm =[]
pmp =[]
mpp =[]
mmp =[]
mpm =[]
pmm =[]
mmm =[]
for i in range(N):
    xp = x[i]
    xm = -x[i]
    yp = y[i]
    ym = -y[i]
    zp = z[i]
    zm = -z[i]
    ppp.append(xp+yp+zp)
    ppm.append(xp+yp+zm)
    pmp.append(xp+ym+zp)
    mpp.append(xm+yp+zp)
    mmp.append(xm+ym+zp)
    mpm.append(xm+yp+zm)
    pmm.append(xp+ym+zm)
    mmm.append(xm+ym+zm)
ppp.sort(reverse=True)
ppm.sort(reverse=True)
pmp.sort(reverse=True)
mpp.sort(reverse=True)
mmp.sort(reverse=True)
mpm.sort(reverse=True)
pmm.sort(reverse=True)
mmm.sort(reverse=True)
print(max(sum(ppp[0:M]),sum(ppm[0:M]),sum(pmp[0:M]),sum(mpp[0:M]),sum(mmp[0:M]),sum(mpm[0:M]),sum(pmm[0:M]),sum(mmm[0:M])))
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)


# def debug(var, name="hoge"):
#     print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
#     return


def main():
    MOD = 10**9 + 7
    S = list(input()[:-1])
    L = len(S)
    modsum = 0
    # 余り
    memo_prev = [0 for _ in range(13)]
    memo_prev[0] = 1
    memo = [0 for _ in range(13)]

    for i in range(L):
        memo = [0 for _ in range(13)]
        # 数字なら以前までの余りにたす
        if S[i].isnumeric():
            for m in range(13):
                cur = (10*m+int(S[i]))%13
                memo[cur] += memo_prev[m]
        # ?なら1~10の余りのケース全てをためす
        else:
            for n in range(10):
                for m in range(13):
                    cur = (10*m+n)%13
                    memo[cur] += memo_prev[m]
                    memo[cur] %= MOD
        memo_prev = memo.copy()
    print(memo[5])


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import exit, stderr, stdin
input = stdin.readline


def main():
    MOD = 10**9 + 7
    S = input()[:-1]
    L = len(S)
    # 余り
    memo = [0 for _ in range(13)]
    memo[0] = 1

    for i in range(L):
        memo_prev = [x for x in memo]
        memo = [0 for _ in range(13)]
        # 数字なら以前までの余りにたす
        if S[i].isnumeric():
            n = int(S[i])
            for m in range(13):
                cur = (10*m+n)%13
                memo[cur] += memo_prev[m]
        # ?なら1~10の余りのケース全てをためす
        else:
            for n in range(10):
                for m in range(13):
                    cur = (10*m+n)%13
                    memo[cur] += memo_prev[m]
            for m in range(13):
                memo[m] %= MOD
    print(memo[5])


if __name__ == "__main__":
    main()
import sys
n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()))
a.append(0)
ans=[]
for i in range(m-1):
    if a[i+1]-a[i]==1:
        print(0)
        sys.exit()
ans=[0 for i in range(n+5)]
ans[1]=1
ans[2]=2
d=0
if a[0]==1:
    ans[1]=0
    ans[2]=1
    d+=1
if a[0]==2 or a[1]==2:
    ans[2]=0
    d+=1

for i in range(1,n+3):
    if i+2==a[d]:
        ans[i+2]=0
        d+=1
    else:
        ans[i+2]=ans[i+1]%1000000007+ans[i]%1000000007
   
print(ans[n]%1000000007)
    
    
    

        


### FIXED CODE ###

import sys
n,m=map(int,input().split())
a=[]
d=0
for i in range(m):
    a.append(int(input()))
a.append(0)
a.append(0)
a.append(0)
ans=[]
for i in range(m-1):
    if a[i+1]-a[i]==1:
        print(0)
        sys.exit()
ans=[0 for i in range(n+5)]
ans[1]=1
ans[2]=2

if a[0]==1:
    ans[1]=0
    ans[2]=1
    d+=1
if a[0]==2 or a[1]==2:
    ans[2]=0
    d+=1

for i in range(1,n+3):
    if i+2==a[d]:
        ans[i+2]=0
        d+=1
    else:
        ans[i+2]=ans[i+1]%1000000007+ans[i]%1000000007
   
print(ans[n]%1000000007)
a=int(input())
b=int(input())
if a%500 =< b:
  print("YES")
else:
  print("NO")


### FIXED CODE ###

a=int(input())
b=int(input())
if a%500 <= b:
  print("Yes")
else:
  print("No")
N, K = map( int, input().split() )
S = str( input() )
S[ K - 1 ] = S[ K - 1 ].lower()
print( S )

### FIXED CODE ###

N, K = map( int, input().split() )
S = list( input() )
S[ K - 1 ] = S[ K - 1 ].lower()
print( "".join(S) )
white, black = map(int,input().split())
white -= 1
black -= 1

grid = [['#' for i in range(100)] for j in range(100)]
for i in range(1, 99):
    for j in range(50, 99):
        grid[i][j] = "."

a = 3
b = 3
while True:
    grid[a][b] = "."
    white -= 1
    a += 2
    if a > 93:
        a = 3
        b += 2
    if white == 0:
        break
 
c = 3
d = 53
while True:
    grid[c][d] = "#"
    black -= 1
    c += 2
    if c > 93:
        c = 3
        d += 2
    if black == 0:
        break

print(100, 100)
for i in grid:
    print("".join(i))

### FIXED CODE ###

white, black = map(int,input().split())
white -= 1
black -= 1

grid = [['#' for i in range(100)] for j in range(100)]
for i in range(1, 99):
    for j in range(50, 99):
        grid[i][j] = "."

a = 3
b = 3
while True:
    if white == 0:
        break
    grid[a][b] = "."
    white -= 1
    a += 2
    if a > 93:
        a = 3
        b += 2
    
 
c = 3
d = 53
while True:
    if black == 0:
        break
    grid[c][d] = "#"
    black -= 1
    c += 2
    if c > 93:
        c = 3
        d += 2
    

print(100, 100)
for i in grid:
    print("".join(i))