#include <bits/stdc++.h>
using namespace std;
string s[100], psw;
bool myfunction(string s1, string s2) { return (s1.length() < s2.length()); }
int main() {
  int n, k, psw_l, flag = 0, l, first, last;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s, s + n, myfunction);
  cin >> psw;
  psw_l = psw.length();
  for (int i = 0; i < n; i++) {
    l = s[i].length();
    if (l == psw_l && flag == 0) first = i + 1;
    if (l == psw_l) flag = 1;
    if (l > psw_l && flag == 1) last = i;
    if (l > psw_l) flag = 0;
  }
  if (flag == 1) last = n;
  cout << first + ((first - 1) / k) * 5 << " " << last + ((last - 1) / k) * 5
       << endl;
  return 0;
}
