#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, q, a[111], was[111], szm = 0;
  double mean[111];
  memset((was), (0), sizeof(was));
  cin >> n >> k;
  for (int _n(n), i(0); i < _n; i++) cin >> a[i];
  cin >> q;
  for (int _n(q), i(0); i < _n; i++) {
    int x;
    mean[szm] = 0;
    for (int _n(n / k), j(0); j < _n; j++) {
      cin >> x;
      was[--x] = true;
      mean[szm] += a[x];
    }
    mean[szm++] /= (n / k);
  }
  int mx = k * (n / k);
  int sz = 0;
  int b[111];
  for (int _n(n), i(0); i < _n; i++)
    if (!was[i]) b[sz++] = a[i];
  if (sz > n - k * (n / k)) {
    sort(b, b + sz);
    mean[szm++] = 1. * accumulate(b, b + (n / k), 0) / (n / k);
    mean[szm++] = 1. * accumulate(b + sz - (n / k), b + sz, 0) / (n / k);
  }
  printf("%6f %6f\n", *min_element(mean, mean + szm),
         *max_element(mean, mean + szm));
  return 0;
}
