#include <bits/stdc++.h>
using namespace std;
bool seen[200];
int lvl[200];
int main() {
  int N, K;
  cin >> N >> K;
  memset(seen, false, sizeof(seen));
  for (int i = 0; i < N; ++i) cin >> lvl[i];
  int Q;
  cin >> Q;
  int T = N / K;
  double mi = 1e9, ma = 0;
  int CNT = 0;
  for (int q = 0; q < Q; ++q) {
    double f = 0;
    for (int i = 0; i < T; ++i) {
      int idx;
      cin >> idx;
      idx--;
      if (!seen[idx]) CNT++;
      f += lvl[idx];
      seen[idx] = true;
    }
    mi = min(mi, f);
    ma = max(ma, f);
  }
  vector<int> V;
  for (int i = 0; i < N; ++i)
    if (!seen[i]) V.push_back(lvl[i]);
  sort(V.begin(), V.end());
  if (V.size() >= T && CNT < T * K) {
    double f = 0;
    for (int i = 0; i < min(T, (int)V.size()); ++i) f += V[i];
    mi = min(mi, f);
    ma = max(ma, f);
    f = 0;
    for (int i = (int)V.size() - 1; i >= (int)V.size() - T; --i) f += V[i];
    mi = min(mi, f);
    ma = max(ma, f);
  }
  printf("%0.10lf %0.10lf\n", mi / (double)T, ma / (double)T);
}
