#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const int N = 2e5 + 100;
int n, k;
int f(int num) {
  return (num % k) == 0 ? num + 5 * ((num / k) - 1) : num + 5 * (num / k);
}
int main() {
  int i, j;
  cin >> n >> k;
  vector<string> v;
  for (i = 0; i < n; ++i) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  string p;
  cin >> p;
  int l = 0, r = 0;
  for (i = 0; i < n; ++i) {
    if (v[i].size() < p.size())
      ++l;
    else if (v[i].size() == p.size())
      ++r;
  }
  cout << f(l + 1) << ' ' << f(l + r) << endl;
  return 0;
}
