#include <bits/stdc++.h>
using namespace std;
int N, K;
int corte, uguali, lunghe;
vector<string> s;
int seconds(int position) { return (position + 1 + 5 * (position / K)); }
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    string x;
    cin >> x;
    s.push_back(x);
  }
  string password;
  cin >> password;
  for (int i = 0; i < N; i++) {
    if (s[i].size() < password.size())
      corte++;
    else if (s[i].size() == password.size())
      uguali++;
    else
      lunghe++;
  }
  cout << seconds(corte) << " " << seconds(corte + uguali - 1);
  return 0;
}
