#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p = 1, x, ret = 0, d;
  scanf("%d %d", &d, &n);
  while (n--) {
    scanf("%d", &x);
    if (p != 1) ret += d - p + 1;
    p = x == d ? 1 : x + 1;
  }
  printf("%d\n", ret);
  return 0;
}
