#include <bits/stdc++.h>
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;

int main(){
    long a,sum=0;
    cin>>a;
    int b;
    cin>>b;
    int n[b];
    for(int i=0;i<b;i++){
        cin>>n[i];
        sum+=n[i];
    }
    cout<<a-sum;
    return 0;
}