#include <bits/stdc++.h>
using namespace std;
int n, k, ans_l, ans;
map<int, int> input;
char s[101];
int main() {
  scanf("%d%d", &n, &k);
  for (int32_t i = (0); i < (n); ++i) {
    scanf("%s\n", s);
    auto it = input.insert(make_pair(strlen(s), 0));
    ++it.first->second;
  }
  scanf("%s\n", s);
  ans_l = strlen(s);
  auto it = input.begin();
  for (; it != input.end(); ++it) {
    if (it->first == ans_l) break;
    ans += it->second;
  }
  int mn = ans + ans / k * 5;
  printf("%d ", mn + 1);
  ans += it->second - 1;
  int mx = ans + ans / k * 5;
  printf("%d ", mx + 1);
  return 0;
}
