/*
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
// 3104. STL priority_queue
int heap[201];
int heapSize = 0;
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void push(int value) {
int i;
heap[++heapSize] = value;
for (i = heapSize; i > 1; i /= 2) {
if (heap[i] > heap[i / 2]) {
swap(&heap[i], &heap[i / 2]);
} else {
break;
}
}
}
void pop() {
if (heapSize == 0) {
return;
}
int depth, maxChild, maxChildIndex;
int index = 1;
heap[1] = heap[heapSize--];
heap[heapSize + 1] = INT_MIN;
for (depth = 0; depth < ceil(log2(heapSize)); depth++) {
if (heap[index * 2] > heap[index * 2 + 1]) {
maxChild = heap[index * 2];
maxChildIndex = index * 2;
} else {
maxChild = heap[index * 2 + 1];
maxChildIndex = index * 2 + 1;
}
if (heap[index] >= maxChild) {
break;
} else {
swap(&heap[index], &heap[maxChildIndex]);
index = maxChildIndex;
}
}
}
int top() {
if (heapSize == 0) {
return -1;
}
return heap[1];
}
int size() {
return heapSize;
}
int empty() {
return heapSize == 0;
}
int main() {
int n, i, j, x;
char command[6] = {0};
for (i = 1; i < 201; i++) {
heap[i] = INT_MIN;
}
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("\n%c", &command[0]);
for (j = 1; command[j - 1] != '('; j++) {
scanf("%c", &command[j]);
}
command[j - 1] = '\0';
scanf("%*c");
if (strcmp(command, "push") == 0) {
scanf("%d%*c%*c", &x);
push(x);
} else if (strcmp(command, "top") == 0) {
printf("%d\n", top());
} else if (strcmp(command, "pop") == 0) {
pop();
} else if (strcmp(command, "size") == 0){
printf("%d\n", size());
} else {
if (empty()) {
printf("true\n");
} else {
printf("false\n");
}
}
}
return 0;
}
*/
#include <stdio.h>
// 4033. 네모네모 로직
int splitResult[21][21] = {0};
int main() {
int n, k, i, j, emptySpaceToSplit;
int filledCells = 0;
scanf("%d\n%d", &n, &k);
for (i = 0; i < k; i++) {
scanf("%d", &j);
filledCells += j;
}
emptySpaceToSplit = n - filledCells - k + 1;
for (i = 1; i <= k + 1; i++) {
splitResult[i][1] = i;
}
for (i = 2; i <= emptySpaceToSplit; i++) {
splitResult[1][i] = 1;
}
for (i = 2; i <= k + 1; i++) {
for (j = 2; j <= emptySpaceToSplit; j++) {
splitResult[i][j] = splitResult[i - 1][j] + splitResult[i][j - 1];
}
}
if (splitResult[k + 1][emptySpaceToSplit] == 0) {
printf("1");
} else {
printf("%d", splitResult[k + 1][emptySpaceToSplit]);
}
return 0;
}