#include<bits/stdc++.h>
using namespace std;
int main() { 
    // freopen("charnum.in","r",stdin);
    // freopen("charnum.out","w",stdout);
	int n,m;
	cin>>n>>m;
	while (m--) {
		int t;
		cin>>t;
		n-=t;
	}
	cout<<n;
	return 0; 
}