#include <bits/stdc++.h>
using namespace std;

int main() {
    long long N;
    long long M;
    cin >> N >> M;
    long long A[M];
    long long sum = 0;
    for (long long i = 0; i < M; ++i) {
        cin >> A[i];
        sum += A[i];
    }
    long long difference = (N - sum);
    cout << difference << endl;
    return 0;
}
