#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, string> a, pair<int, string> b) { return a.first < b.first; }
int main() {
  vector<pair<int, string>> v;
  string s, x;
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v.emplace_back(x.size(), x);
  }
  sort(v.begin(), v.end(), cmp);
  cin >> s;
  int best = 0, cnta = 0, cntb = 0, worst = 0;
  for (int i = 0; i < n; i++) {
    if (v[i].first < s.size()) {
      best++;
      cnta++;
      if (cnta == k) {
        best += 5;
        cnta = 0;
      }
    } else if (v[i].first == s.size() && v[i].second != s) {
      worst++;
      cnta++;
      if (cnta == k) {
        worst += 5;
        cnta = 0;
      }
    } else if (v[i].first > s.size()) {
      break;
    }
  }
  cout << best + 1 << " " << best + worst + 1;
  return 0;
}
