#include <bits/stdc++.h>
int main() {
  int i, n, k, str1[200], j, max, x = 0, y = 0, z, m;
  char str[200][2000];
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%s", str[i]);
    str1[i] = strlen(str[i]);
  }
  scanf("%s", str[n]);
  for (i = 0; i < n; i++) {
    max = str1[i];
    for (j = 0; j < n; j++) {
      if (max < str1[j]) {
        max = str1[j];
        str1[j] = str1[i];
        str1[i] = max;
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (str1[i] < strlen(str[n])) x++;
    if (str1[i] == strlen(str[n])) y++;
  }
  z = n - (x + y);
  if (x + 1 > k) {
    if ((x + 1) % k == 0) {
      z = (x + 1) + (((x + 1) / k) - 1) * 5;
    }
    if ((x + 1) % k != 0) {
      z = (x + 1) + ((x + 1) / k) * 5;
    }
  } else
    z = x + 1;
  printf("%d ", z);
  if (k > n) m = x + y;
  if ((x + y) % k == 0) {
    m = (x + y) + (((x + y) / k) - 1) * 5;
  }
  if ((x + y) % k != 0) {
    m = (x + y) + ((x + y) / k) * 5;
  }
  printf("%d", m);
  return 0;
}
