#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int d, n, x, ans = 0;
  cin >> d >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    if (a[i - 1] == d)
      continue;
    else
      ans += (d - a[i - 1]);
  }
  cout << ans;
  return 0;
}
