#include <bits/stdc++.h>
using namespace std;
long long t, n, m, g = 0, o, k;
bool q = 0, e = 0;
double long y;
long long j, i, l, p = -1;
vector<long long> visited(1e6, 0), vv, v, w(1e6, 0);
multiset<long long> qq;
string s, h, c;
char d, u = 'a';
unordered_map<char, int> mp, mpp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m - 1; i++) {
    cin >> t;
    k = k + n - t;
  }
  cout << k << "\n";
  return 0;
}
