#include <bits/stdc++.h>
using namespace std;
int T[101];
int A[101];
bool R[101];
int main(void) {
  int j, i, n, k, m, s, x, e;
  long double pmin = 100, pmax = 0, pcur;
  cin >> n >> k;
  s = n / k;
  e = n - s * k;
  for (i = 1; i <= n; i++) cin >> T[i], R[i] = true;
  cin >> m;
  for (j = 0; j < m; j++) {
    pcur = 0;
    for (i = 0; i < s; i++) {
      cin >> x;
      pcur += T[x];
      R[x] = false;
    }
    pcur /= s;
    pmax = max(pmax, pcur);
    pmin = min(pmin, pcur);
  }
  for (i = 1, j = 0; i <= n; i++)
    if (R[i]) A[++j] = T[i];
  sort(A + 1, A + j + 1);
  if (j > e) {
    pcur = 0;
    for (i = 1; i <= s; i++) pcur += A[i];
    pcur /= s;
    pmax = max(pmax, pcur);
    pmin = min(pmin, pcur);
    pcur = 0;
    for (i = j - s + 1; i <= j; i++) pcur += A[i];
    pcur /= s;
    pmax = max(pmax, pcur);
    pmin = min(pmin, pcur);
  }
  cout.precision(12);
  cout << fixed << pmin << " " << pmax;
  return 0;
}
