#include <bits/stdc++.h>
int main() {
  int n, m, s = 0, i;
  int a[100];
  scanf("%d", &n);
  scanf("%d", &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &a[i]);
    s += a[i];
  }
  printf("%d\n", n - s);
  return 0;
}
