#include <bits/stdc++.h>
using namespace std;
int main(void) {
  cout.precision(10);
  cout.setf(ios::fixed, ios::floatfield);
  int n, k;
  while (cin >> n >> k) {
    int score[101];
    for (int i = 0; i < n; ++i) cin >> score[i];
    bool appear[101] = {};
    int amount = n / k;
    double mini = 10000.0, maxi = -10000.0;
    int qqs;
    cin >> qqs;
    int used = 0;
    for (int qq = 0; qq < qqs; ++qq) {
      int problem;
      double result = 0.0;
      for (int i = 0; i < amount; ++i) {
        cin >> problem;
        --problem;
        if (i == 0 && !appear[problem]) used++;
        appear[problem] = true;
        result += score[problem];
      }
      result /= amount;
      if (result < mini) mini = result;
      if (result > maxi) maxi = result;
    }
    vector<int> remain;
    for (int i = 0; i < n; ++i)
      if (!appear[i]) remain.push_back(score[i]);
    if (used < k && remain.size() >= amount) {
      sort(remain.begin(), remain.end());
      double small = 0.0, large = 0.0;
      for (int i = 0; i < amount; ++i) small += remain[i];
      for (int i = remain.size() - 1; i >= (int)remain.size() - amount; --i)
        large += remain[i];
      small /= amount;
      large /= amount;
      if (small < mini) mini = small;
      if (large > maxi) maxi = large;
    }
    cout << mini << ' ' << maxi << endl;
  }
  return 0;
}
