st=[1,1]
for i in range(10**5+1):
  st.append((st[-1]+st[-2])%1000000007)
st.append(0)
n,m=list(map(int,input().split()))
ret=1
x=-1
for i in range(m):
  y=int(input())
  ret=(ret*st[y-x-2])%1000000007
  print(x,y,y-x-2,st[y-x-2])
  x=y
ret=(ret*st[n-x-1])%1000000007
print(x,n,n-x-2,st[n-x-2])
print(ret)