#include <bits/stdc++.h>
using namespace std;
const int INF = ~(1 << 31);
const double pi = acos(-1);
int main() {
  cin.sync_with_stdio(false);
  int sizes[120];
  memset(sizes, 0, sizeof(sizes));
  int n, k;
  cin >> n >> k;
  for (int i = (0); i < (n); i++) {
    string s;
    cin >> s;
    sizes[s.size()]++;
  }
  string ok;
  cin >> ok;
  int wantsize = ok.size();
  vector<int> all;
  for (int i = (0); i < (101); i++) {
    for (int a = (0); a < (sizes[i]); a++) all.push_back(i);
  }
  int time = 0;
  int wrong = 0;
  int mn = -1, mx = 0;
  for (int i = (0); i < (all.size()); i++) {
    wrong++;
    time += 1;
    if (all[i] == wantsize) {
      if (mn == -1) mn = time;
      mx = time;
    }
    if (wrong == k) {
      time += 5;
      wrong = 0;
    }
  }
  cout << mn << " " << mx << endl;
  return 0;
}
