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