#include <bits/stdc++.h>
using namespace std;
int main() {
  long long d, n;
  cin >> d >> n;
  long long a, s = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    if (i != n - 1) s += d - a;
  }
  cout << s;
}
