#include <bits/stdc++.h>
using namespace std;
struct question {
  int id, prof;
} temp;
vector<question> v;
bool use[110];
double maxi = -1, mini = 100000000, tem;
bool compare(question a, question b) { return a.prof > b.prof; }
int main() {
  int n, k, val, q, i, sum, j, l = 0;
  cin >> n >> k;
  temp.id = 0;
  temp.prof = 0;
  v.push_back(temp);
  for (i = 1; i <= n; i++) {
    cin >> temp.prof;
    temp.id = i;
    v.push_back(temp);
  }
  cin >> q;
  for (i = 0; i < q; i++) {
    sum = 0;
    for (j = 0; j < (n / k); j++) {
      cin >> val;
      if (use[val] == false) {
        use[val] = true;
        ++l;
      }
      sum += v[val].prof;
    }
    tem = (double)sum / (n / k);
    if (maxi < tem) {
      maxi = tem;
    }
    if (mini > tem) {
      mini = tem;
    }
  }
  if (l / (n / k) == k) {
    printf("%lf %lf\n", mini, maxi);
    return 0;
  }
  sort(v.begin() + 1, v.end(), compare);
  int take = 0;
  sum = 0;
  for (i = 1; i <= n && take < (n / k); i++) {
    if (use[v[i].id] == false) {
      sum += v[i].prof;
      take++;
    }
  }
  tem = (double)sum / (n / k);
  if (take == (n / k)) {
    if (maxi < tem) {
      maxi = tem;
    }
  }
  take = 0;
  sum = 0;
  for (i = n; i > 0 && take < (n / k); i--) {
    if (use[v[i].id] == false) {
      sum += v[i].prof;
      take++;
    }
  }
  tem = (double)sum / (n / k);
  if (mini > tem && take == (n / k)) mini = tem;
  printf("%lf %lf\n", mini, maxi);
  return 0;
}
