#include <bits/stdc++.h>
using namespace std;
string s, t;
int a[300000];
int main() {
  ios_base::sync_with_stdio(false);
  int i, j, m, k = 0, l = 0, n;
  cin >> k >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (i != n - 1) l += (k - a[i]);
  }
  cout << l << endl;
  return 0;
}
