#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

int main()
{
  int n,m;cin >> n>>m;
  int sum,j=0;
  while (cin>>j)sum+=j;
  if(sum>n) cout<<n-sum;
  else cout<<n-sum;
  return 0;
}