#include <bits/stdc++.h>
using namespace std;
const long long MAX_SIZE = ((long long)1e6 + 5);
vector<long long> isprime(MAX_SIZE, true);
vector<long long> prime;
vector<long long> SPF(MAX_SIZE);
void seive() {
  long long N = MAX_SIZE;
  isprime[0] = isprime[1] = false;
  for (long long i = 2; i < N; i++) {
    if (isprime[i]) {
      prime.push_back(i);
      SPF[i] = i;
    }
    for (long long j = 0;
         j < (long long)prime.size() && i * prime[j] < N && prime[j] <= SPF[i];
         j++) {
      isprime[i * prime[j]] = false;
      SPF[i * prime[j]] = prime[j];
    }
  }
}
signed main() {
  long long n, d, x;
  cin >> n >> d;
  long long sum = 0;
  for (long long i = 0; i < d; i++) {
    cin >> x;
    if (i != d - 1) sum += abs(x - n);
  }
  cout << sum;
}
