#include <bits/stdc++.h>
int main() {
  int N, x, y, d, resp = 0;
  scanf("%d %d %d", &d, &N, &x);
  while (--N) {
    resp += (d - x);
    scanf("%d", &y);
    x = y;
  }
  printf("%d\n", resp);
  return 0;
}
