#include <bits/stdc++.h>
using namespace std;
int f(int num, int k) { return num + (num / k - (num % k == 0)) * 5; }
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> strs(n);
  int password;
  string temp;
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    strs[i] = temp.size();
  }
  cin >> temp;
  password = temp.size();
  sort(strs.begin(), strs.end());
  bool flag = false;
  int first, last;
  for (int i = 0; i < strs.size(); ++i) {
    if (strs[i] == password && !flag) {
      flag = true;
      first = i + 1;
    }
    if (strs[i] > password && flag) {
      flag = false;
      last = i;
      break;
    }
  }
  if (flag) last = strs.size();
  cout << f(first, k) << " " << f(last, k);
  return 0;
}
