#include <bits/stdc++.h>
using namespace std;
int main() {
  int chotu = 0;
  int equal = 0;
  int n, k;
  string str;
  cin >> n >> k;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> str;
    m[str.size()]++;
  }
  cin >> str;
  for (auto it = m.begin(); it != m.end(); it++)
    if (it->first < str.size())
      chotu += it->second;
    else if (it->first == str.size())
      equal += it->second;
  int ans = chotu + (chotu / k) * 5 + 1;
  cout << ans << " ";
  ans = chotu + equal + 5 * ((chotu + equal) / k);
  if ((chotu + equal) % k == 0) ans -= 5;
  cout << ans << endl;
  return 0;
}
