#include <bits/stdc++.h>
using namespace std;
void require(bool cond, const string& message = "Runtime error") {
  if (!cond) {
    cerr << message << endl;
    assert(false);
  }
}
void readData() {}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < int(n); ++i) cin >> a[i];
  int q;
  vector<bool> used(n);
  cin >> q;
  set<int> val;
  int m = n / k;
  int r = 0;
  for (int it = 0; it < int(q); ++it) {
    vector<int> nums(m);
    int s = 0;
    for (int i = 0; i < int(m); ++i) cin >> nums[i], s += a[nums[i] - 1];
    if (used[nums[0] - 1]) continue;
    for (int i = 0; i < int(m); ++i) used[nums[i] - 1] = true;
    val.insert(s);
    ++r;
  }
  r = k - r;
  vector<int> nu;
  for (int i = 0; i < int(n); ++i)
    if (!used[i]) nu.push_back(a[i]);
  sort(nu.begin(), nu.end());
  if (r > 0) {
    int s = 0;
    for (int i = 0; i < int(m); ++i) s += nu[i];
    val.insert(s);
    int sz = nu.size() - 1;
    s = 0;
    for (int i = 0; i < int(m); ++i) s += nu[sz - i];
    val.insert(s);
  }
  set<int>::iterator it = val.end();
  --it;
  cout.precision(10);
  cout << fixed;
  cout << ((long double)(*val.begin())) / m << " " << ((long double)(*it)) / m
       << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  readData();
  solve();
  return 0;
}
