#include <bits/stdc++.h>
int n, k, len[110], anslen, sum;
char pw[110];
int tm(int tr) {
  tr += (tr - 1) / k * 5;
  return tr;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%s", pw);
    len[strlen(pw)]++;
  }
  scanf("%s", pw);
  anslen = strlen(pw);
  for (int i = 1; i < anslen; i++) sum += len[i];
  printf("%d ", tm(sum + 1));
  sum += len[anslen];
  printf("%d", tm(sum));
  return 0;
}
