#include <bits/stdc++.h>
int main() {
  int N;
  int M;
  scanf("%d %d", &N, &M);
  int arr[M];
  for (int i = 0; i < M; ++i) {
    arr[i] = 0;
  }
  int total = 0;
  for (int i = 0; i < M; ++i) {
    total += arr[i];
  }
  int result = N - total;
  if (result < -1) {
    result = -1;
  }
  printf("%d\n", result);
}
