#include <bits/stdc++.h>
const long long INF = 1e18;
const int32_t M = 1e6 + 3;
using namespace std;
void solve() {
  long long c = 0, d, n;
  cin >> d >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (i == n - 1) break;
    c += d - a[i];
  }
  cout << c;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
