#include <bits/stdc++.h>
using namespace std;
int n, k;
string password;
int minimo = 0, maximo = 0;
int main() {
  cin >> n >> k;
  string temp;
  vector<int> groupsSize(101, 0);
  for (int i = 0; i < n; i++) {
    cin >> temp;
    groupsSize[temp.size()]++;
  }
  cin >> password;
  int generalTime = 0;
  int acum = 0;
  for (int i = 0; i < password.size(); i++) {
    generalTime += groupsSize[i];
    acum += groupsSize[i];
  }
  minimo = generalTime + 1 + 5 * int(acum / k);
  acum += groupsSize[password.size()] - 1;
  maximo =
      (generalTime + 1) + 5 * int(acum / k) + groupsSize[password.size()] - 1;
  cout << minimo << " " << maximo << endl;
  return 0;
}
