#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[1000];
  int start = 0, end = 0, b[10000];
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%s", a);
    b[i] = strlen(a);
  }
  int l;
  scanf("%s", a);
  l = strlen(a);
  for (int i = 0; i < n; i++) {
    if (b[i] < l) start++;
    if (b[i] > l) end++;
  }
  start = start + 1;
  end = n - end;
  int best, worst;
  if ((start) % k == 0)
    best = (start) + ((start) / k - 1) * 5;
  else
    best = (start) + ((start) / k) * 5;
  if ((end) % k == 0)
    worst = (end) + ((end) / k - 1) * 5;
  else
    worst = (end) + ((end) / k) * 5;
  printf("%d %d", best, worst);
  return 0;
}
