#include <bits/stdc++.h>
using namespace std;
int a[101];
int used[101];
int b[101];
int n, k, q;
int main() {
  while (scanf("%d %d", &n, &k) == 2) {
    int min = 2147483647;
    int max = -1;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      used[i] = 0;
    }
    int size_of_card = n / k;
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
      int ans = 0;
      for (int j = 0; j < size_of_card; j++) {
        int t;
        scanf("%d", &t);
        t--;
        used[t] = 1;
        ans += a[t];
      }
      if (ans < min) min = ans;
      if (ans > max) max = ans;
    }
    int re = 0;
    for (int i = 0; i < n; i++) {
      if (used[i] == 1) continue;
      b[re] = a[i];
      re++;
    }
    if (n - re == size_of_card * k || re < size_of_card) {
      printf("%.8lf %.8lf\n", double(min + 1e-10) / size_of_card,
             double(max + 1e-10) / size_of_card);
      continue;
    }
    sort(b, b + re);
    int ans = 0;
    for (int i = 0; i < size_of_card; i++) {
      ans += b[i];
    }
    if (ans < min) min = ans;
    if (ans > max) max = ans;
    ans = 0;
    for (int i = re - size_of_card; i < re; i++) {
      ans += b[i];
    }
    if (ans < min) min = ans;
    if (ans > max) max = ans;
    printf("%.8lf %.8lf\n", double(min + 1e-10) / size_of_card,
           double(max + 1e-10) / size_of_card);
  }
  return 0;
}
