#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, x, y, pass[103], max, min, curr, ans, total;
  char c;
  memset(pass, 0, sizeof(pass));
  max = total = 0;
  min = 101;
  scanf("%d %d", &n, &k);
  getchar();
  for (x = 0; x < n; x++) {
    curr = 0;
    while ((c = getchar()) != '\n') curr++;
    pass[x] = curr;
  }
  curr = 0;
  while ((c = getchar()) != '\n') curr++;
  ans = curr;
  sort(pass, pass + n);
  total = 0;
  for (x = 0; x < n; x++) {
    total++;
    if (pass[x] == ans) break;
  }
  printf("%d ", total + ((total - 1) / k * 5));
  while (pass[x] == ans) {
    x++;
    total++;
  }
  total--;
  printf("%d\n", total + ((total - 1) / k * 5));
  return 0;
}
