import math
def conbination(x,y):
  return math.factrial(x) // (math.factrial(x-y) * math.factrial(y))

n, m = map(int, input().split())
a = [int(i) for i in input().split()]
flag = 0
ans = 0

for i in range(n-1):
  if a[i+1] - a[i] == 1:
    ans = 0
    flag = 1
    break
    
if flag == 0:
  for i in range(n-2*m-1): #i:２段のぼる回数
    ans += conbination(n-2*m-2, i)
      
print(ans%(10**9+7))  