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

sum = 0
start = 0
for i in range(M):
  sum += (a[i] - start - 1)**2
  start = a[i] + 1
  
sum += (N - a[M-1] - 1)**2
print(sum % 1000000007)