#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<string> vp;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    vp.push_back(s);
  }
  string p;
  cin >> p;
  sort(vp.begin(), vp.end(),
       [](string p1, string p2) { return p1.size() < p2.size(); });
  auto begin_it = vp.begin();
  auto end_it = vp.end();
  auto found_it =
      find_if(begin_it, end_it, [p](string s) { return s.size() == p.size(); });
  assert(found_it != end_it);
  int ret;
  ret = (found_it - begin_it);
  cout << 1 + ret + (ret / k) * 5 << " ";
  for (found_it++; found_it != end_it && found_it->size() == p.size();
       found_it++)
    ;
  ret = (found_it - begin_it) - 1;
  cout << 1 + ret + (ret / k) * 5 << endl;
}
