#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INFLL = 1LL << 60;
const int INF = 1 << 28;
void solve(int a) { cout << (a ? "Yes" : "No") << endl; }
int main() {
  int na, nb;
  int ans = 0;
  cin >> na >> nb;
  int bef;
  set<int> all;
  int suball = 0;
  map<int, int> sub;
  for (int i = 0; i < na; i++) {
    cin >> bef;
    all.emplace(bef);
    sub[bef] += 0;
    sub[bef]++;
  }
  for (int i = 0; i < nb; i++) {
    cin >> bef;
    all.emplace(bef);
    sub[bef] += 0;
    sub[bef]++;
    if (sub[bef] == 2) {
      suball++;
    }
  }
  printf("%.9lf\n", (double)suball / all.size());
}
