#include <bits/stdc++.h>
using namespace std;
int n, k;
int slen[105];
int plen;
int main() {
  cin >> n >> k;
  string s;
  for (int i = 0; i < n; i++) cin >> s, slen[i] = s.length();
  cin >> s;
  plen = s.length();
  slen[n] = 1000;
  sort(slen, slen + n + 1);
  for (int i = 0; i < n + 1; i++)
    if (slen[i] == plen) {
      cout << i / k * 5 + (i + 1) << " ";
      break;
    }
  for (int i = 0; i < n + 1; i++)
    if (slen[i] > plen) {
      cout << (i - 1) / k * 5 + i << endl;
      break;
    }
}
