#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, shortLen = INT_MAX, cnt = 0, best = 0, worst = 0;
  cin >> n >> k;
  string s[n], pass;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    shortLen = min(shortLen, (int)s[i].length());
  }
  cin >> pass;
  if (shortLen == pass.length()) {
    best = 1;
    for (int i = 0; i < n; i++) {
      if (s[i] != pass && s[i].length() == pass.length()) {
        worst++;
        cnt++;
      }
      if (cnt && cnt % k == 0) {
        worst += 5;
        cnt = 0;
      }
    }
    cout << best << ' ' << worst + 1 << endl;
    return 0;
  } else {
    for (int i = 0; i < n; i++) {
      if (s[i].length() < pass.length()) {
        best++;
        cnt++;
      }
      if (cnt && cnt % k == 0) {
        best += 5;
        cnt = 0;
      }
    }
    worst = best;
    for (int i = 0; i < n; i++) {
      if (s[i] != pass && s[i].length() == pass.length()) {
        worst++;
        cnt++;
      }
      if (cnt && cnt % k == 0) {
        worst += 5;
        cnt = 0;
      }
    }
    cout << best + 1 << ' ' << worst + 1 << endl;
  }
  return 0;
}
