#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3ffffff;
const int N = 300020;
long long int n;
long long int k;
long long int ar[N];
long long int q;
bool v[N] = {0};
double mmin = INF;
double mmax = -1.00000;
bool comp(long long int x, long long int y) { return x > y; }
int main() {
  cin >> n >> k;
  for (long long int i = 1; i <= n; i++) cin >> ar[i];
  cin >> q;
  long long int temp = q;
  while (q--) {
    double val = 0.000;
    for (long long int i = 1; i <= floor(n / k); i++) {
      long long int x;
      cin >> x;
      v[x] = 1;
      val += ar[x];
    }
    val /= (double)(floor)(n / k);
    mmin = min(mmin, val);
    mmax = max(mmax, val);
  }
  vector<long long int> ans;
  for (long long int i = 1; i <= n; i++) {
    if (v[i]) continue;
    ans.push_back(ar[i]);
  }
  sort(ans.begin(), ans.end());
  long long int ct = floor(n / k);
  double val = 0;
  long long int pp = 0;
  for (long long int i = 1; i <= n; i++) pp = pp + (v[i]);
  pp /= ct;
  if (ans.size() < ct || pp >= k) {
    printf("%0.9lf %0.9lf", mmin, mmax);
    return 0;
  }
  for (long long int i = 0; i < ct; i++) val += ans[i];
  val /= (double)floor(n / k);
  mmin = min(mmin, val);
  sort(ans.begin(), ans.end(), comp);
  val = 0;
  for (long long int i = 0; i < ct; i++) val += ans[i];
  val /= (double)floor(n / k);
  mmax = max(mmax, val);
  printf("%0.9lf %0.9lf", mmin, mmax);
  return 0;
}
