#include <bits/stdc++.h>
const long long OO = LLONG_MAX;
const long long _OO = LLONG_MIN;
const long long MOD = 1e9 + 7;
const double PI = acos(-1);
const double EPSILON = std::numeric_limits<double>::epsilon();
bool double_comp(double a, double b) { return fabs(a - b) < EPSILON; }
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int d;
  cin >> d;
  int n;
  cin >> n;
  int prev;
  int res = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (i == 0 || prev == d) {
      prev = a;
      continue;
    } else if (prev + 1 < d)
      res += d - prev;
    else if (prev + 1 == d)
      res++;
    prev = a;
  }
  cout << res;
}
