#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(20);
  long long n;
  cin >> n;
  long long m;
  cin >> m;
  long long a[n];
  long long b[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  for (int i = 0; i < n; ++i) {
    if (a[i] == 1 || b[i] == 1) {
      cout << -1 << endl;
      return 0;
    }
  }
  long double l = 1, r = 10e9 + 5, mid = (r + l) / 2;
  long double ans = -1;
  while (abs(mid) >= 10e-15) {
    mid = (l + r) / 2;
    long long flag = 0;
    long double tmp = mid;
    for (int i = 0; i < n; ++i) {
      long double x = (long double)(m + mid) / (long double)a[i];
      mid -= x;
      long double y = (long double)(m + mid) / (long double)(b[(i + 1) % n]);
      mid -= y;
      if (mid < 0) {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      ans = tmp;
      r = tmp - 1;
    } else {
      l = tmp + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
