#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b;
  cin >> a >> b;
  cout << setprecision(10) << endl;
  if (a < b) {
    cout << -1 << endl;
  } else if (a == b) {
    cout << a << endl;
  } else {
    int d1 = floor((a + b) / b);
    int d2 = floor((a - b) / b);
    d1 &= ~1;
    d2 &= ~1;
    cout << min((a + b) / d1, (a - b) / d2) << endl;
  }
  return 0;
}
