#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 1e6 + 7;
const int Inf = 1 << 30;
const LL INF = 1LL << 60;
int n, m;
int a[maxx];

int main() {
	cin >> n >> m;
	LL sum = 0;
	for(int i = 1; i <= m; i++) {
		cin >> a[i];
		sum += (LL)a[i];
	}
	LL ans = max(0LL, (LL)n - sum);
	cout << ans << endl;
	return 0;
}