#include <bits/stdc++.h>
using namespace std;
bool cmp(string a, string b) {
  if (a.size() < b.size())
    return 1;
  else
    return 0;
}
int main() {
  int n, k, best = 0, worst = 0, len, i, m, g = 0, same = 0, ans = 0;
  cin >> n >> k;
  string arr[105], fin;
  for (i = 0; i < n; i++) cin >> arr[i];
  cin >> fin;
  len = fin.size();
  sort(arr, arr + n, cmp);
  for (i = 0; i < n; i++) {
    m = arr[i].size();
    if (g == k) {
      g = 0;
      ans = ans + 5;
    }
    if (m < len) {
      g++;
      ans = ans + 1;
    } else if (m == len)
      same++;
    else if (m > len)
      break;
  }
  best = ans + 1;
  for (i = 0; i < same; i++) {
    if (g == k) {
      g = 0;
      ans = ans + 5;
    }
    ans = ans + 1;
    g++;
  }
  worst = ans;
  cout << best << " " << worst << endl;
  return 0;
}
