#include <bits/stdc++.h>
using namespace std;
bool comp(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.second == b.second) return b.first > a.first;
  return (a.second < b.second);
}
bool compmx(int a, int b) { return (a < b); }
long long int bin(long long int n) {
  long long int B_Number = 0;
  long long int cnt = 0;
  while (n != 0) {
    long long int rem = n % 2;
    long long int c = pow(10, cnt);
    B_Number += rem * c;
    n /= 2;
    cnt++;
  }
  return B_Number;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
bool is_prime(long long int x) {
  if (x == 1) return false;
  if (x == 2 || x == 3) return true;
  for (long long int i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int d, n;
  cin >> d >> n;
  ;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  };
  long long int ans = 0;
  long long int x;
  for (long long int i = 1; i < n; i++) {
    x = a[i - 1] + 1;
    if (x > d) x = 1;
    if (x == 1)
      continue;
    else
      ans += (d - x + 1);
  }
  cout << ans << endl;
  return 0;
}
