#include <bits/stdc++.h>
using namespace std;
int main() {
  int d, n;
  cin >> d >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  long long sum = 0;
  for (int i = 1; i < n; i++) {
    if (v[i - 1] != d) sum += d - v[i - 1];
  }
  cout << sum << endl;
  return 0;
}
