#include <bits/stdc++.h>
using namespace std;
int n, k;
const int N = 101;
string s[N], ans;
int res1, res2;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> s[i];
  cin >> ans;
  int cntLess = 0;
  for (int i = 1; i <= n; i++)
    if (s[i].length() < ans.length()) cntLess++;
  int nn = 0;
  for (int i = 1; i <= n; i++)
    if (s[i].length() <= ans.length()) nn++;
  res1 = (cntLess / k) * 5 + cntLess + 1;
  res2 = ((nn / k) - (nn % k == 0)) * 5 + nn;
  cout << res1 << " " << res2 << "\n";
  return 0;
}
