#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, x, y, aa;
  scanf("%I64d %I64d", &x, &y);
  if (y > x) {
    printf("-1\n");
    return 0;
  }
  a = x / y;
  if ((x % y) && (a % 2)) a++;
  if (!(a % 2))
    aa = a - 1;
  else
    aa = a;
  double cc = (double)(x - aa * y);
  double c = cc / (double)a;
  double res = y + c;
  printf("%0.11lf\n", res);
  return 0;
}
