#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int INF = 1e9 + 7;
const int N = 1e5 + 10;
int n, m, t, k;
int b[N], lin[20][20];
char s[N];
int fa[N], num[N];
bool vis[N];
double ans[N];
string str[25];
map<pair<string, string>, int> mp;
struct node {
  int id, v;
} a[N];
bool cmp(node aa, node bb) { return aa.v < bb.v; }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].v);
    a[i].id = i;
  }
  scanf("%d", &m);
  memset(vis, 0, sizeof(vis));
  int p = floor(n / k);
  t = 0;
  int sum = 0;
  int mm = 0;
  bool fg = true;
  for (int j = 0; j < m; j++) {
    sum = 0;
    fg = true;
    for (int i = 0, x; i < p; i++) {
      scanf("%d", &x);
      sum += a[x].v;
      if (vis[x]) fg = false;
      vis[x] = true;
    }
    if (fg) {
      ans[t++] = (double)sum / p;
      mm++;
    }
  }
  if (mm == k) {
    sort(ans, ans + t);
    printf("%.10f %.10f\n", ans[0], ans[t - 1]);
    return 0;
  }
  sort(a + 1, a + n + 1, cmp);
  int cnt = 0;
  sum = 0;
  bool f = false;
  for (int i = 1; i <= n; i++) {
    if (vis[a[i].id]) continue;
    sum += a[i].v;
    cnt++;
    if (cnt == p) {
      f = true;
      break;
    }
  }
  if (f) ans[t++] = (double)sum / p;
  cnt = 0;
  sum = 0;
  f = false;
  for (int i = n; i > 0; i--) {
    if (vis[a[i].id]) continue;
    sum += a[i].v;
    cnt++;
    if (cnt == p) {
      f = true;
      break;
    }
  }
  if (f) ans[t++] = (double)sum / p;
  sort(ans, ans + t);
  printf("%.10f %.10f\n", ans[0], ans[t - 1]);
  return 0;
}
