#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;

int main(void){
    int N,M;
  	scanf("%d %d", &N,&M);
    int l, i=0, a[M];
    while(cin>>l){
        a[i] = l;
        i++;
    }
  	int sum = 0;
  	for(i=0;i<M;i++){
      sum = sum+a[i];
    }
  	int ans = N-sum;
  	printf("%d",ans);
	}
 