use strict;

my ($n, $m) = split(/ /, <>);
my @a = ();

while(<>) {
    push @a, int($_);
}

# validate
my $last = $a[0];
foreach my $x (@a[1..$#a]) {
    if ($x - $last <= 1) {
        print "0";
        exit 0;
    }
    $last = $x;
}

# 分割する
push @a, $n+1;
my $cnt = 0;
my $st = 0;
foreach my $en (@a) {
    # $st から $en-1までのステップ数を計算する
    my $tmp = steps($en - 1 - $st);
    # print STDERR "$st --> $en-1 == $tmp\n";

    $cnt = $cnt + $tmp;
    $st = $en + 1;
}
print ($cnt % 1_000_000_007);
exit 0;

sub steps {
    my $seq_len = shift;
    # スキップ無し = 1
    my $cnt = 1;
    # print STDERR "1 = " . $cnt . "\n";
    # 1回スキップ = $n - 1
    my $cnt = $cnt + $seq_len - 1;
    # print STDERR "2 = " . $cnt . "\n";
    # 2回以上スキップ
    my $z = $seq_len - 3;
    my $p = 2;
    while($z > 0) {
        $cnt = $cnt + sum_p_q($p, $z);
        # print STDERR "p/z = $p/$z = " . $cnt . "\n";
        $z = $z - 2;
        $p = $p + 1;
    }
    return $cnt;
}

# sum_1(5) = 5 - 1
# sum_2(5) = 1 + 2 + 3 + 4 + 5
# sum_3(5) = sum_2(5) + sum_2(4) + sum_2(3) + sum_2(2) + sum_2(1)
sub sum_p_q() {
    my $p = shift;
    my $q = shift;
    my $cnt = 0;
    # print STDERR "  p = " . $p . "  q = " . $q . "\n";
    if($p==2) {
        for(my $j=1; $j<=$q; $j++) {
            $cnt = $cnt + $j;
        }
    }else {
        for(my $j=1; $j<=$q; $j++) {
            $cnt = $cnt + sum_p_q($p-1, $j);
        }
    }
    return $cnt;
}
