#include <bits/stdc++.h>
using namespace std;
string c, t;
bool cmp(const string &a, const string &b) { return a.length() < b.length(); }
vector<string> v;
int main() {
  int n, k;
  v.clear();
  cin >> n >> k;
  while (n--) {
    cin >> t;
    v.push_back(t);
  }
  cin >> c;
  sort(v.begin(), v.end(), cmp);
  int cnt = 0;
  for (auto it : v) {
    if (it.length() < c.length())
      cnt++;
    else
      break;
  }
  cout << cnt / k * 5 + cnt + 1 << " ";
  cnt = 0;
  for (auto it : v) {
    if (it.length() > c.length()) break;
    cnt++;
  }
  cout << (cnt - 1) / k * 5 + cnt << endl;
}
