#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  string *tab = new string[n];
  for (int i = 0; i < n; i++) cin >> tab[i];
  cin >> s;
  int same = 0, smaller = 0;
  for (int i = 0; i < n; i++) {
    if (tab[i].size() == s.size()) same++;
    if (tab[i].size() < s.size()) smaller++;
  }
  int answer1 = 0, answer2 = 0;
  answer1 = smaller + smaller / k * 5 + 1;
  answer2 = smaller + same - 1 + (smaller + same - 1) / k * 5 + 1;
  cout << answer1 << " " << answer2;
  delete[] tab;
}
