#include <bits/stdc++.h>
using namespace std;
long long a[1000010], b[1000], d[1000010], p[10010];
long long mn = 1e18, mx = -1e18, ans, cnt, sm = 1, n, m;
bool ok, okk, u[1000010], uu[310][310], uk[1000010];
char ck[510][510], ch[100010];
int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
vector<pair<long long, long long> > g[900010];
int main() {
  long long dd;
  cin >> dd >> n;
  for (int i = 0; i < n - 1; i++) {
    long long x;
    cin >> x;
    ans += dd - x;
  }
  cin >> dd;
  cout << ans;
  return 0;
}
