#include<bits/stdc++.h>
#define mod 1000000000
#define ll long long
#define _USE_MATH_DEFINES
using namespace std;
int main()
{
int m,n;
cin>>m>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
m-=a[i];
}
cout<<m;
}
