#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:60000000")
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
double const pi = 3.1415926535897932384626433832795;
int const inf = (1 << 30) - 1;
long long const inf64 = (1LL << 62) - 1;
const string name = "b";
int a[101], used[101];
vector<int> www;
int n, k, q, _min, _max, N;
int main() {
  cin >> n >> N;
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  memset(used, 0, sizeof(used));
  cin >> q;
  k = n / N;
  _min = inf, _max = -inf;
  int cnt = 0;
  for (int i = 0; i < (int)q; i++) {
    int now = 0, ok = 1;
    for (int j = 0; j < (int)k; j++) {
      int tmp;
      cin >> tmp;
      tmp--;
      if (used[tmp]) ok = 0;
      used[tmp] = 1;
      now += a[tmp];
    }
    if (ok) cnt++;
    _min = min(now, _min);
    _max = max(now, _max);
  }
  for (int i = 0; i < (int)n; i++)
    if (!used[i]) www.push_back(a[i]);
  sort((www).begin(), (www).end());
  if (cnt < N) {
    int now = 0;
    for (int i = 0; i < (int)k; i++) now += www[i];
    _min = min(now, _min);
    _max = max(now, _max);
    now = 0;
    for (int i = 0; i < (int)k; i++) now += www[www.size() - i - 1];
    _min = min(now, _min);
    _max = max(now, _max);
  }
  printf("%.10lf %.10lf\n", _min / (double)k, _max / (double)k);
  return 0;
}
