#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000 + 5;
int K, N, nec[MAX_N], alt[MAX_N], tot[MAX_N];
double dp[MAX_N], cnt[MAX_N], comb[MAX_N][MAX_N];
vector<int> price[MAX_N], totp;
int main() {
  for (int i = 0; i < MAX_N; i++)
    for (int j = 0; j <= i; j++)
      if (j)
        comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
      else
        comb[i][j] = 1.0;
  scanf("%d %d", &K, &N);
  for (int i = 0; i < N; i++) {
    int k;
    scanf("%d", &k);
    while (k--) {
      int v;
      scanf("%d", &v);
      price[i].push_back(v);
      totp.push_back(v);
    }
  }
  sort(totp.begin(), totp.end());
  int cut = totp[totp.size() - K];
  for (int i = 0; i < N; i++) {
    tot[i] = price[i].size();
    for (__typeof(price[i].begin()) it = price[i].begin(); it != price[i].end();
         ++it)
      if (*it > cut)
        nec[i]++;
      else if (*it == cut)
        alt[i]++;
  }
  dp[0] = 1.0;
  cnt[0] = 1.0;
  for (int i = 0; i < N; i++)
    for (int j = 1000; j >= 0; j--) {
      double upd = dp[j];
      dp[j] = 0.0;
      if (upd > 1e-10) {
        for (int k = nec[i]; k <= nec[i] + alt[i]; k++)
          dp[j + k] += upd * comb[alt[i]][k - nec[i]] / comb[tot[i]][k];
      }
      upd = cnt[j];
      cnt[j] = 0.0;
      if (upd > 1e-10) {
        for (int k = nec[i]; k <= nec[i] + alt[i]; k++) cnt[j + k] += upd;
      }
    }
  double res = dp[K] / cnt[K];
  printf("%.13f\n", res);
  return 0;
}
