#include <bits/stdc++.h>
using namespace std;
void start() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  cout.precision(10);
}
long long a[110000];
bool isprime[90000001];
vector<long long> ans;
int32_t main() {
  start();
  long long n, d;
  cin >> d >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long cur = 1, ans = 0;
  for (long long i = 0; i < n; i++) {
    if (cur != 1) {
      ans += d - cur + 1;
      cur = 1;
    }
    cur = a[i] + 1;
    if (cur > d) cur = 1;
  }
  cout << ans << endl;
  return 0;
}
