#include <bits/stdc++.h>
using namespace std;
int main() {
  int* th[105] = {0};
  int mark[105];
  double max = 0.0, min = 100.0, cmax, cmin;
  int n, k, i, j, q, c, thc, tmp, t;
  cin >> n >> k;
  for (i = 1; i <= n; ++i) {
    cin >> mark[i];
  }
  thc = n / k;
  c = k * thc;
  cin >> q;
  for (i = 0; i < q; ++i) {
    cmax = 0;
    cmin = 0;
    j = 0;
    while (j < thc) {
      ++j;
      cin >> tmp;
      cmax += mark[tmp];
      cmin += mark[tmp];
      th[tmp] = &mark[tmp];
    }
    cmax /= (double)thc;
    cmin /= (double)thc;
    if (max < cmax) max = cmax;
    if (min > cmin) min = cmin;
  }
  for (i = 1; i < n; ++i)
    for (j = i + 1; j <= n; ++j) {
      if (mark[j] < mark[i]) {
        int hold = mark[j];
        mark[j] = mark[i];
        mark[i] = hold;
        int* _hold = th[i];
        th[i] = th[j];
        th[j] = _hold;
      }
    }
  t = 0;
  for (i = 1; i <= n; ++i)
    if (th[i] == 0) t++;
  if (t > n - k * thc) {
    for (i = 1; i <= n; ++i) {
      j = 0;
      cmax = 0;
      cmin = 0;
      t = i;
      while (j < thc && t <= n) {
        if (th[t] == 0) {
          ++j;
          cmax += mark[t];
          cmin += mark[t];
        }
        ++t;
      }
      cmax /= (double)thc;
      cmin /= (double)thc;
      if (j == thc) {
        if (max < cmax) {
          max = cmax;
        }
        if (min > cmin) {
          min = cmin;
        }
      }
    }
  }
  cout << showpoint << setprecision(12) << min << " " << max << endl;
  return 0;
}
