#include <bits/stdc++.h>
using namespace std;
using pil = pair<long long, long long>;
template <class T>
using numr = std::numeric_limits<T>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long a;
  for (long long i = 0; i < m; i++) {
    cin >> a;
    n -= a;
  }
  cout << n << endl;
}
