#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  int d, n;
  cin >> d >> n;
  int p, ans = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (i == 0) {
      p = x;
      continue;
    }
    int diff = d - p;
    ans += diff;
    p = x;
  }
  cout << ans << "\n";
  return 0;
}
