#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, j, best(0), worst(0), lcount(0), tcount(0);
  cin >> n;
  cin >> k;
  if (n == 0) return 0;
  vector<string> keys;
  string realKey, s;
  for (i = 0; i < n; i++) {
    cin >> s;
    keys.push_back(s);
  }
  cin >> realKey;
  i = 0;
  while (i < n) {
    if (keys[i].length() < realKey.length()) {
      lcount++;
    }
    if (keys[i].length() <= realKey.length()) tcount++;
    i++;
  }
  best = ((lcount / k) * 5) + lcount + 1;
  worst = (((tcount - 1) / k) * 5) + tcount;
  cout << best << " " << worst;
  return 0;
}
