#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
int binarySearch(int arr[], int n, int x) {
  int l = 0;
  int r = n - 1;
  while (r >= l) {
    int mid = l + (r - l) / 2;
    if (arr[mid] == x)
      return mid;
    else if (arr[mid] > x)
      r = mid - 1;
    else
      l = mid + 1;
  }
  return -1;
}
vector<long long int> vprimes;
void sieve(long long int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (long long int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long int p = 2; p <= n; p++)
    if (prime[p]) vprimes.push_back(p * p);
}
bool ispower(int a, int b) {
  int r1 = log(b) / log(a);
  double r2 = log(b) / log(a);
  return (r1 == r2);
}
bool isprime(long long int n) {
  if (n == 1)
    return false;
  else {
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) return false;
    }
    return true;
  }
}
bool comp(pair<int, int> a, pair<int, int> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  }
  return a.first > b.first;
}
bool compfi(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first < b.first;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int d, n;
  cin >> d >> n;
  vector<int> v(n);
  int total = 0;
  for (auto &e : v) {
    cin >> e;
    if (e < d) total += (d - e);
  }
  cout << total - (d - v[n - 1]);
  return 0;
}
