#AGC013E. [AGC013E] Placing Squares

[AGC013E] Placing Squares

Score : 16001600 points

Problem Statement

Joisino has a bar of length NN, which has MM marks on it. The distance from the left end of the bar to the ii-th mark is XiX_i.

She will place several squares on this bar. Here, the following conditions must be met:

  • Only squares with integral length sides can be placed.
  • Each square must be placed so that its bottom side touches the bar.
  • The bar must be completely covered by squares. That is, no square may stick out of the bar, and no part of the bar may be left uncovered.
  • The boundary line of two squares may not be directly above a mark.

Examples of arrangements that satisfy/violate the conditions

The beauty of an arrangement of squares is defined as the product of the areas of all the squares placed. Joisino is interested in the sum of the beauty over all possible arrangements that satisfy the conditions. Write a program to find it. Since it can be extremely large, print the sum modulo 109+710^9+7.

Constraints

  • All input values are integers.
  • 1N1091 \leq N \leq 10^9
  • 0M1050 \leq M \leq 10^5
  • 1X1<X2<...<XM1<XMN11 \leq X_1 < X_2 < ... < X_{M-1} < X_M \leq N-1

Input

Input is given from Standard Input in the following format:

NN MM

X1X_1 X2X_2 ...... XM1X_{M-1} XMX_M

Output

Print the sum of the beauty over all possible arrangements that satisfy the conditions, modulo 109+710^9+7.

3 1
2
13

There are two possible arrangements:

  • Place a square of side length 11 to the left, and place another square of side length 22 to the right
  • Place a square of side length 33

The sum of the beauty of these arrangements is (1×1×2×2)+(3×3)=13(1 \times 1 \times 2 \times 2) + (3 \times 3) = 13.

5 2
2 3
66
10 9
1 2 3 4 5 6 7 8 9
100
1000000000 0
693316425