#include <bits/stdc++.h>
using namespace std;
struct T {
  int i, p;
};
struct T a[110];
int i, j, k, l, n, m, q, b[110][110], c[110], e[110], u, v, t, f[110], p, o;
int cmp(const void *x, const void *y) {
  const T *u = (T *)x;
  const T *v = (T *)y;
  return u->p - v->p;
}
int main() {
  u = 1e9;
  v = -1;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    a[i].i = i;
    cin >> f[i];
    a[i].p = f[i];
  }
  qsort(a, n, sizeof(struct T), cmp);
  l = n / k;
  cin >> q;
  for (i = 0; i < q; i++) {
    t = 0;
    o = 1;
    for (j = 0; j < l; j++) {
      cin >> m;
      if (c[m - 1]) o = 0;
      c[m - 1] = 1;
      t += f[m - 1];
    }
    if (o) {
      p++;
      if (t < u) u = t;
      if (t > v) v = t;
    }
  }
  if (p < k) {
    t = i = j = 0;
    while (j < l) {
      while (i < n && c[a[i].i]) i++;
      t += a[i].p;
      i++;
      j++;
    }
    if (t < u) u = t;
    t = j = 0;
    i = n - 1;
    while (j < l) {
      while (i >= 0 && c[a[i].i]) i--;
      t += a[i].p;
      i--;
      j++;
    }
    if (t > v) v = t;
  }
  printf("%0.6f %0.6f", 1.0 * u / l, 1.0 * v / l);
  return 0;
}
