#include <bits/stdc++.h>
using namespace std;
int main() {
  int d, n;
  cin >> d;
  cin >> n;
  int a[2000];
  for (int i = 0; i < n; i++) cin >> a[i];
  int finish_prev_month = a[0] + 1;
  int ans = 0;
  for (int month = 1; month < n; month++) {
    if (finish_prev_month != 1) ans += d - finish_prev_month + 1;
    finish_prev_month = a[month] + 1;
  }
  cout << ans << '\n';
}
