#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e6 + 5;
const int nax = (int)3e5 + 5;
void compute() {
  int d, n;
  cin >> d >> n;
  int res = 0, last;
  for (int i = 0; i < (int)n; ++i) {
    int x;
    cin >> x;
    if (i == 0) {
      last = min(x, d);
      continue;
    }
    res += (d - last);
    last = min(x, d);
  }
  cout << res << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  compute();
  return 0;
}
