#include <bits/stdc++.h>
using namespace std;
int n, k;
string S[200], pass;
bool cmp(string a, string b) {
  if (a.size() != b.size()) return a.size() < b.size();
  return a == pass && b != pass;
}
bool cmp_2(string a, string b) {
  if (a.size() != b.size()) return a.size() < b.size();
  return a != pass && b == pass;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> S[i];
  cin >> pass;
  sort(S, S + n, cmp);
  int w = 0, ans1 = 0;
  for (int i = 0; i < n; i++) {
    ans1++;
    if (S[i] != pass) {
      w++;
      if (w == k) ans1 += 5, w = 0;
    } else
      break;
  }
  sort(S, S + n, cmp_2);
  w = 0;
  int ans2 = 0;
  for (int i = 0; i < n; i++) {
    ans2++;
    if (S[i] != pass) {
      w++;
      if (w == k) ans2 += 5, w = 0;
    } else
      break;
  }
  cout << ans1 << " " << ans2;
  return 0;
}
