#include int main(){ int n,m;std::cin>>n>>m; std::cout<<(n==m?1:n%2==0&&n/2<=m?2:-1)<