var memo = [1];
function Main(input) {
    var result;
    const N = parseInt(input.shift());
    const M = parseInt(input.shift());
    const As = input.map(a => parseInt(a)).filter(function (x, i, self) {
        return self.indexOf(x) === i;
    });
    
    // 前処理
    var lastA = -10;
    for (var i = 0; i < As.length; i++) {
        var element = As[i];
        if(element-1 == lastA) {
            console.log("0");
            return;
        }
        lastA = element;
    }

    for (var i = 1; i < N; i++) {
        memo.push(memo[i-1] * i);
    }

    var divs = [];
    lastA = -1;
    for (var i = 0; i < As.length; i++) {
        var element = As[i];
        divs.push(getPattern(element - lastA - 2));
        lastA = element;
    }
    
    divs.push(getPattern(N -lastA -1));
    
    result = 1;
    divs.forEach(element => {
        result *= element;
      result %= 1000000007;
    });
    
    console.log(result);
    
}

function getPattern(div) {
    // console.log("div",div);
    
    var result = 0;
    var maxTwo = Math.floor(div/2);
    
    for (var two = 0; two <= maxTwo; two++) {
        // console.log(div - two*2, two);
        
        result += get12Pattern(div - two*2, two);
    }
    // console.log("result", result);
    
    return result;
}

function get12Pattern(one, two){
    // console.log(one, two);
    
    return kaijo(one+two) / (kaijo(one) * kaijo(two));
}

function kaijo(value) {
    return memo[value];
}

// 改行・空白で分割
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));