#include <bits/stdc++.h>
char password[110][110], ans[110];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%s", password[i]);
  }
  int pwlen;
  scanf("%s", ans);
  pwlen = strlen(ans);
  int less = 0, eq = 0;
  for (int i = 0; i < n; i++) {
    int len = strlen(password[i]);
    if (len == pwlen) eq++;
    if (len < pwlen) less++;
  }
  int min, max;
  if ((less + 1) % k == 0)
    min = (less + 1) + 5 * ((less) / k);
  else
    min = (less + 1) + 5 * ((less + 1) / k);
  if ((less + eq) % k == 0)
    max = (less + eq) + 5 * ((less + eq - 1) / k);
  else
    max = (less + eq) + 5 * ((less + eq) / k);
  printf("%d %d\n", min, max);
}
