#include <bits/stdc++.h>
using namespace std;
string str[200];
long long n, k;
bool cmp(string a, string b) { return a.length() < b.length(); }
string a;
int main() {
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> str[i];
  sort(str + 1, str + n + 1, cmp);
  cin >> a;
  long long best = 0, worst = 0, u = 0;
  for (long long i = 1; i <= n; i++) {
    if (u == k) best += 5, u = 0;
    if (str[i].length() < a.length()) u++, best++;
    if (str[i].length() == a.length()) break;
  }
  u = 0, worst = 0;
  for (long long i = 1; i <= n; i++) {
    if (str[i].length() > a.length()) break;
    if (u == k) worst += 5, u = 0;
    if (str[i].length() <= a.length()) u++, worst++;
  }
  cout << best + 1 << " " << worst << endl;
}
