#include <bits/stdc++.h>
int main() {
  int n, k, length[105], len, min, max, temp, total = 0, x;
  char pass[105];
  scanf("%d %d", &n, &k);
  memset(length, 0, sizeof(length));
  min = 100;
  max = 0;
  for (x = 0; x < n; x++) {
    scanf("%s", pass);
    temp = strlen(pass);
    length[temp]++;
    if (temp < min) min = temp;
    if (temp > max) max = temp;
  }
  scanf("%s", pass);
  len = strlen(pass);
  for (x = min; x <= max; x++) {
    if (len == x) {
      min = total + 1;
      max = total + length[x];
      break;
    }
    total += length[x];
  }
  min = min + (((min - 1) / k) * 5);
  max = max + (((max - 1) / k) * 5);
  printf("%d %d\n", min, max);
  return 0;
}
