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