#include <bits/stdc++.h>
using namespace std;
int const N = 2005;
long long a[N];
int main() {
  long long d;
  int n;
  cin >> d >> n;
  memset(a, 0, sizeof(a));
  int day = 0;
  long long c = 0;
  for (int i = int(0); i < int(n); i++) cin >> a[i];
  for (int i = int(0); i < int(n); i++) {
    if (day == 0)
      day = a[i] - 1;
    else {
      c += d - day;
      day = a[i] - 1;
    }
    day++;
  }
  cout << c << endl;
  return 0;
}
