#include <bits/stdc++.h>
using namespace std;
double m1 = 200.0, m2 = 0.0, DV;
int card, n, k, Q, getcard;
int a[110], vs[110], b[110], len = 0;
int sum = 0, tmp;
int main() {
  memset(vs, 0, sizeof(vs));
  scanf("%d%d", &n, &k);
  card = (int)(n / k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  scanf("%d", &Q);
  for (int i = 1; i <= Q; ++i) {
    sum = 0;
    for (int j = 1; j <= card; ++j) {
      scanf("%d", &tmp);
      sum += a[tmp];
      vs[tmp] = 1;
    }
    DV = double(sum) / double(card);
    if (DV < m1) m1 = DV;
    if (DV > m2) m2 = DV;
  }
  for (int i = 1; i <= n; ++i)
    if (!vs[i]) b[++len] = a[i];
  getcard = (n - len) / card;
  if (len >= card && getcard < k) {
    sort(b + 1, b + len + 1);
    sum = 0;
    for (int i = 1; i <= card; ++i) sum += b[i];
    DV = double(sum) / double(card);
    if (DV < m1) m1 = DV;
    if (DV > m2) m2 = DV;
    sum = 0;
    for (int i = len - card + 1; i <= len; ++i) sum += b[i];
    DV = double(sum) / double(card);
    if (DV < m1) m1 = DV;
    if (DV > m2) m2 = DV;
  }
  printf("%.10lf %.10lf\n", m1, m2);
  return 0;
}
