#include<cstdio>
#include<cstring>
#include<map>
#include<algorithm>
using namespace std;
int a,b;
int main()
{
	scanf("%d %d",&a,&b);
	if(a==b)
	{
		printf("-1\n");
		return 0;
	}
	printf("%d\n",a*(b+1));
}