#include <bits/stdc++.h>
using namespace std;
bool comp(string a, string b) { return a.length() < b.length(); }
int main() {
  int n, k;
  cin >> n >> k;
  string s[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  sort(s, s + n, comp);
  string ans;
  cin >> ans;
  int aa = 0, bb = 0, p = 0, cc = 0;
  for (int i = 0; i < n; i++) {
    aa++;
    cc++;
    if (s[i].length() == ans.length()) break;
    if (cc == k) {
      aa = aa + 5;
      cc = 0;
    }
  }
  cout << aa << " ";
  aa = 0;
  bb = 0;
  p = 0;
  cc = 0;
  int prev = 0;
  for (int i = 0; i < n; i++) {
    if (s[i].length() > ans.length()) break;
    prev = aa;
    aa++;
    cc++;
    if (cc == k) {
      aa = aa + 5;
      cc = 0;
    }
  }
  cout << prev + 1 << " ";
  return 0;
}
