#include int main(int argc, char const *argv[]) { int N, K; scanf("%d %d", &N, &K); if (N < K) { puts("-1"); } else { printf("%d", K - 1); } }