#include <bits/stdc++.h>
using namespace std;
struct suberti {
  int a;
  bool x;
};
bool operator<(suberti a, suberti b) { return a.a < b.a; }
suberti make_sub(int a, bool x) {
  suberti tmp;
  tmp.a = a;
  tmp.x = x;
  return tmp;
}
int n, k, q, sum;
double now, maximum, minimum = 1000000000.0;
suberti a[101];
int main() {
  int i, j, w, c, p;
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &w);
    a[i] = make_sub(w, false);
  }
  w = n / k;
  scanf("%d", &q);
  maximum = -1.0;
  for (i = 0; i < q; i++) {
    sum = 0;
    for (j = 0; j < w; j++) {
      scanf("%d", &c);
      a[c - 1].x = true;
      sum += a[c - 1].a;
    }
    now = double(sum) * 1.0 / double(w);
    if (i == 0) {
      minimum = now;
      maximum = minimum;
    } else {
      if (now < minimum) minimum = now;
      if (now > maximum) maximum = now;
    }
  }
  p = 0;
  for (i = 0; i < n; i++)
    if (a[i].x) p += 1;
  if (p / w < k) {
    sort(a, a + n);
    p = 0;
    sum = 0;
    for (i = 0; i < n; i++)
      if (!a[i].x) {
        sum += a[i].a;
        p += 1;
        if (p == w) break;
      }
    if (p == w) {
      now = double(sum) * 1.0 / double(w);
      if (now < minimum) minimum = now;
      if (now > maximum) maximum = now;
    }
    p = 0;
    sum = 0;
    for (i = n - 1; i >= 0; i--)
      if (!a[i].x) {
        sum += a[i].a;
        p += 1;
        if (p == w) break;
      }
    if (p == w) {
      now = double(sum) * 1.0 / double(w);
      if (now < minimum) minimum = now;
      if (now > maximum) maximum = now;
    }
  }
  printf("%.6f %.6f\n", minimum, maximum);
}
